Merge remote-tracking branch 'origin/ywMes'
77个文件已添加
37个文件已修改
10个文件已删除
5 文件已重命名
| | |
| | | public class BigStorageCageBaseInfo { |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | @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 = "玻璃id") |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | @ApiModelProperty(value = "x坐标", position = 13) |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | @ApiModelProperty(value = "y坐标", position = 14) |
| | | private Integer yCoordinate; |
| | | |
| | | } |
| 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; |
| | | } |
| File was renamed from hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/entity/BigStorageCageTask.java |
| | |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * (BigStorageCageInOneTask)表实体类 |
| | |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class BigStorageCageTask { |
| | | /** |
| | | * 玻璃id |
| File was renamed from hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/mapper/BigStorageCageTaskMapper.java |
| | |
| | | |
| | | boolean updateTaskMessage(@Param("tableName") String tableName, @Param("task") BigStorageCageTask bigStorageCageInTask); |
| | | |
| | | boolean updateOutTaskMessage(@Param("tableName") String tableName); |
| | | |
| | | int saveTaskMessage(@Param("tableName") String tableName, @Param("list") List<BigStorageCageTask> taskList); |
| | | |
| | | int removeAll(String tableName); |
| New file |
| | |
| | | package com.mes.bigstoragecagetask.service; |
| | | |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageTask; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (BigStorageCageInOneTask)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-08 21:40:20 |
| | | */ |
| | | public interface BigStorageCageTaskService { |
| | | |
| | | |
| | | List<BigStorageCageTask> queryTaskMessage(String tableName); |
| | | |
| | | boolean updateTaskMessage(String tableName, BigStorageCageTask bigStorageCageInTask); |
| | | |
| | | boolean updateOutTaskMessage(String tableName); |
| | | |
| | | int saveTaskMessage(String tableName, List<BigStorageCageTask> taskList); |
| | | |
| | | int removeAll(String tableName); |
| | | } |
| | | |
| File was renamed from hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/impl/BigStorageCageTaskServiceImpl.java |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateOutTaskMessage(String tableName) { |
| | | return bigStorageCageInTaskMapper.updateOutTaskMessage(tableName); |
| | | } |
| | | |
| | | @Override |
| | | public int saveTaskMessage(String tableName, List<BigStorageCageTask> taskList) { |
| | | return bigStorageCageInTaskMapper.saveTaskMessage(tableName, taskList); |
| | | } |
| | |
| | | public static final Integer TEMPERING_START = 2; |
| | | public static final Integer TEMPERING_SUCCESS = 3; |
| | | public static final Integer TEMPERING_END = 4; |
| | | // public static final Integer TEMPERING_DAMAGE = 8; |
| | | // public static final Integer TEMPERING_TAKE = 9; |
| | | public static final Integer TEMPERING_PAUSE = 5; |
| | | public static final Integer TEMPERING_DAMAGE = 8; |
| | | public static final Integer TEMPERING_TAKE = 9; |
| | | |
| | | /** |
| | | * 下片 |
| | |
| | | public static final Integer BIG_STORAGE_TASK_EMPTY = 0; |
| | | public static final Integer BIG_STORAGE_TASK_RUNNING = 1; |
| | | |
| | | /** |
| | | * 中空大理片笼出片状态I |
| | | * 0 空任务 |
| | | * 1 启动 |
| | | * 2 暂停 |
| | | * 3 完成 |
| | | */ |
| | | public static final Integer HOLLOW_FLOW_CARD_NEW = 0; |
| | | public static final Integer HOLLOW_FLOW_CARD_START = 1; |
| | | public static final Integer HOLLOW_FLOW_CARD_PAUSE = 2; |
| | | public static final Integer HOLLOW_FLOW_CARD_SUCCESS = 3; |
| | | |
| | | } |
| New file |
| | |
| | | package com.mes.glassinfo.entity.dto; |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/28 10:02 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class HollowGlassInfoDTO extends GlassInfo { |
| | | /** |
| | | * 中空线总 |
| | | */ |
| | | private int hollowSequence; |
| | | } |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.entity.dto.HollowGlassInfoDTO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @DS("hangzhoumes") |
| | | public interface GlassInfoMapper extends MPJBaseMapper<GlassInfo> { |
| | | |
| | | List<HollowGlassInfoDTO> listBySize(@Param("engineerId") String engineerId); |
| | | } |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.entity.dto.HollowGlassInfoDTO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | List<Map<String, Object>> getFlowCardId(); |
| | | |
| | | |
| | | |
| | | |
| | | List<HollowGlassInfoDTO> listBySize(String engineerId); |
| | | } |
| | | |
| | |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.entity.OptimizeGlassinfo; |
| | | import com.mes.glassinfo.entity.dto.HollowGlassInfoDTO; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowGlassInfoDTO> listBySize(String engineerId) { |
| | | return baseMapper.listBySize(engineerId); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图id", position = 11) |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图片序", position = 12) |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | @ApiModelProperty(value = "旋转角度(逆时针)", position = 15) |
| | | private Integer angle; |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | @ApiModelProperty(value = "x坐标", position = 13) |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | @ApiModelProperty(value = "y坐标", position = 14) |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 状态 |
| | |
| | | @ApiModelProperty(value = "状态", position = 16) |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 工程id |
| | | */ |
| | | @ApiModelProperty(value = "工程id", position = 17) |
| | | private String engineerId; |
| | | |
| | | @TableLogic |
| | | private int deleted; |
| File was renamed from hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageInTaskMapper.xml |
| | |
| | | where glass_id = #{task.glassId} |
| | | </update> |
| | | |
| | | <update id="updateOutTaskMessage"> |
| | | UPDATE ${tableName} |
| | | SET glass_id = '' |
| | | , start_slot = 0 |
| | | , target_slot = 0 |
| | | , task_state = 0 |
| | | </update> |
| | | |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <?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.glassinfo.mapper.GlassInfoMapper"> |
| | | |
| | | <select id="listBySize" resultType="com.mes.glassinfo.entity.dto.HollowGlassInfoDTO"> |
| | | with glass_list as ( |
| | | SELECT flow_card_id, |
| | | glass_type, |
| | | GREATEST(width, height) as width, |
| | | least(width, height) as height, |
| | | thickness, |
| | | filmsid, |
| | | total_layer, |
| | | layer, |
| | | ismultiple, |
| | | max_width, |
| | | max_height, |
| | | tempering_layout_id, |
| | | tempering_feed_sequence, |
| | | engineer_id, |
| | | glass_id |
| | | FROM glass_info |
| | | where engineer_id = #{engineerId} |
| | | ) |
| | | select row_number() |
| | | over (order by flow_card_id, height desc, width desc, tempering_layout_id, tempering_feed_sequence) as rn, |
| | | t.* |
| | | from glass_list t |
| | | |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>mesHub</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | <!--web 需要启动项目--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <artifactId>servicebase</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| New file |
| | |
| | | package com.mes; |
| | | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/28 15:52 |
| | | * @Description: |
| | | */ |
| | | @SpringBootApplication |
| | | @EnableSwagger2WebMvc |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | @EnableScheduling |
| | | public class MesHubApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(MesHubApplication.class, args); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | application: |
| | | name: cacheGlass |
| | | redis: |
| | | database: 0 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | server: |
| | | port: 8180 |
| | | |
| | | spring: |
| | | application: |
| | | name: mesHub |
| | | liquibase: |
| | | enabled: false |
| | | task: |
| | | scheduling: |
| | | pool: |
| | | size: 10 |
| | | thread-name-prefix: mesHub |
| | | profiles: |
| | | active: dev |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | kangaroohy: |
| | | milo: |
| | | enabled: false |
| | | primary: default |
| | | config: |
| | | default: |
| | | endpoint: opc.tcp://192.168.2.100:49320 |
| | | security-policy: basic256sha256 |
| | | username: admin |
| | | password: 1qaz2wsx3edc4rfv |
| | | |
| | |
| | | package com.mes.edgglasstask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 磨边任务id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | @ApiModelProperty(value = "玻璃id", position = 2) |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | @ApiModelProperty(value = "宽", position = 3) |
| | | private Integer width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | @ApiModelProperty(value = "高", position = 4) |
| | | private Integer height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | @ApiModelProperty(value = "厚度", position = 5) |
| | | private Integer thickness; |
| | | |
| | | private Integer glassType; |
| | | |
| | | private Integer status; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | @ApiModelProperty(value = "状态", position = 6) |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "线路", position = 7) |
| | | private Integer line; |
| | | |
| | | private Date time; |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "开始时间", position = 8) |
| | | private Date createTime; |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "更新时间", position = 9) |
| | | private Date updateTime; |
| | | |
| | | @TableLogic |
| | | private int deleted; |
| | |
| | | } |
| | | LambdaQueryWrapper<EdgGlassTaskInfo> edgGlassWrapper = new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | .in(CollectionUtils.isNotEmpty(request.getCellList()), EdgGlassTaskInfo::getLine, request.getCellList()) |
| | | .in(CollectionUtils.isNotEmpty(request.getStateList()), EdgGlassTaskInfo::getStatus, request.getStateList()) |
| | | .between(null != request.getBeginDate(), EdgGlassTaskInfo::getTime, request.getBeginDate(), request.getEndDate()) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | .in(CollectionUtils.isNotEmpty(request.getStateList()), EdgGlassTaskInfo::getState, request.getStateList()) |
| | | .between(null != request.getBeginDate(), EdgGlassTaskInfo::getCreateTime, request.getBeginDate(), request.getEndDate()) |
| | | .orderByDesc(EdgGlassTaskInfo::getCreateTime); |
| | | return this.list(edgGlassWrapper); |
| | | } |
| | | |
| | |
| | | damageService.insertDamage(damage); |
| | | //修改磨边队列数据状态 |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getStatus, request.getState()).eq(EdgGlassTaskInfo::getGlassId, request.getGlassId())); |
| | | .set(EdgGlassTaskInfo::getState, request.getState()).eq(EdgGlassTaskInfo::getGlassId, request.getGlassId())); |
| | | return "success"; |
| | | } |
| | | |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | public static String engineerId = ""; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | | Date startDate = new Date(); |
| | | log.info("本次任务开始执行时间:{}", startDate); |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("卧式理片破损玻璃清除任务开始执行时间:{}", startDate); |
| | |
| | | edgGlassTaskInfo.setHeight((int) (glassInfo.getHeight() * ratio)); |
| | | edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio)); |
| | | edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio)); |
| | | edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE); |
| | | edgGlassTaskInfo.setState(Const.EDG_GLASS_BEFORE); |
| | | edgGlassTaskInfo.setLine(endcell); |
| | | edgGlassTaskInfo.setTime(new Date()); |
| | | edgGlassTaskInfo.setCreateTime(new Date()); |
| | | edgGlassTaskInfo.setUpdateTime(new Date()); |
| | | //先将历史对列表中本玻璃的数据删除,重新新增一份最新的数据 |
| | | edgGlassTaskInfoService.remove(new LambdaQueryWrapper<EdgGlassTaskInfo>().eq(EdgGlassTaskInfo::getGlassId, glassInfo.getGlassId())); |
| | | return edgGlassTaskInfoService.save(edgGlassTaskInfo); |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void CacheGlassTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void cacheGlassIsRun() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void CacheGlassTaskss() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.edgglasstaskqueueinfo.entity.EdgGlassTaskQueueInfo; |
| | | import com.mes.edgglasstaskqueueinfo.service.EdgGlassTaskQueueInfoService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | |
| | | |
| | | @Resource |
| | | EdgStorageDeviceTaskService edgStorageDeviceTaskService; |
| | | @Resource |
| | | EdgGlassTaskQueueInfoService edgGlassTaskQueueInfoService; |
| | | // @Resource |
| | | // EdgGlassTaskQueueInfoService edgGlassTaskQueueInfoService; |
| | | @Autowired |
| | | EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | @Resource |
| | |
| | | private int threshold; |
| | | @Value("${mes.cellLength}") |
| | | private int cellLength; |
| | | @Value("${mes.ratio}") |
| | | private int ratio; |
| | | |
| | | @Value("${mes.min.one.firstLength}") |
| | | private int minOneFirstLength; |
| | | |
| | | @Value("${mes.min.one.secondLength}") |
| | | private int minOneSecondLength; |
| | | |
| | | @Value("${mes.min.two.firstLength}") |
| | | private int minTwoFirstLength; |
| | | |
| | | @Value("${mes.min.two.secondLength}") |
| | | private int minTwoSecondLength; |
| | | |
| | | private String glassInIdOne = ""; |
| | | private String glassInIdTwo = ""; |
| | | private String glassIdOne = ""; |
| | | private String glassIdTwo = ""; |
| | | |
| | | // @Scheduled(fixedDelay = Long.MAX_VALUE) |
| | | // @Scheduled(fixedDelay = Long.MAX_VALUE) |
| | | // public void startOneOpcTask() throws Exception { |
| | | // miloService.subscriptionFromOpcUa(Arrays.asList("mes.WL1.edg_storage_device_one_task[1].task_state"), cacheGlassStartCallback); |
| | | // } |
| | |
| | | |
| | | private void startOneOpcTaskChild(String tableName, int device) { |
| | | EdgStorageDeviceTask task = edgStorageDeviceTaskService.queryTaskMessage(tableName); |
| | | try { |
| | | // try { |
| | | if (task == null) { |
| | | log.info("任务表基础数据录入失败,请检查数据是否录入成功"); |
| | | return; |
| | |
| | | //防止出片任务且笼前有玻璃的情况,将进片id置空,即出片仅考虑笼内的玻璃 |
| | | task.setGlassIdIn(""); |
| | | } |
| | | int request = task.getTaskState(); |
| | | int request = task.getTaskState(); |
| | | int taskRunning = task.getTaskRunning(); |
| | | log.info("开始执行任务,任务请信息为{}", task); |
| | | if (request == 0) { |
| | | log.info("未收到任务请求,结束本次任务"); |
| | | } else if (request == 1) { |
| | | //进片任务 |
| | | log.info("进片任务:进片玻璃id为:{}", task.getGlassIdIn()); |
| | | if (request == 0) { |
| | | log.info("设备:{}状态:{}", device, request); |
| | | log.info("未收到任务请求,结束本次任务"); |
| | | } else if (request == 1 && taskRunning == 0) { |
| | | //进片任务 |
| | | log.info("设备:{}状态:{}", device, request); |
| | | log.info("进片任务:进片玻璃id为:{}", task.getGlassIdIn()); |
| | | intoTask(task, tableName, device); |
| | | } else if (request == 2 && taskRunning == 0) { |
| | | //出片任务 |
| | | outTask(task, tableName, device); |
| | | } else if (request == 3 && taskRunning == 0) { |
| | | //直通任务 |
| | | log.info("设备:{}状态:{}", device, request); |
| | | if (!outTask(task, tableName, device)) { |
| | | intoTask(task, tableName, device); |
| | | } else if (request == 2) { |
| | | //出片任务 |
| | | outTask(task, tableName, device); |
| | | } else if (request == 3) { |
| | | //直通任务 |
| | | if (!outTask(task, tableName, device)) { |
| | | intoTask(task, tableName, device); |
| | | } |
| | | } else if (request == 4) { |
| | | log.info("将启动子改为0"); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING); |
| | | edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | } else { |
| | | finishTask(task, tableName); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("执行任务过程中发生异常,任务字{},{}", task.getTaskState(), e.getMessage()); |
| | | log.info("将启动子改为0"); |
| | | task.setTaskState(Const.GLASS_CACHE_TYPE_EMPTY); |
| | | } else if (request == 4) { |
| | | log.info("设备:{}状态:{}", device, request); |
| | | log.info("将启动子改为4"); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING); |
| | | edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | } else { |
| | | log.info("设备:{}状态:{}", device, request); |
| | | finishTask(task, tableName); |
| | | } |
| | | // } catch (Exception e) { |
| | | // log.info("执行任务过程中发生异常,任务字{},{}", task.getTaskState(), e.getMessage()); |
| | | // log.info("将启动字改为0"); |
| | | // task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY); |
| | | // edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | miloService.writeToOpcUa(list); |
| | | miloService.writeToOpcWord(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".thickness", (int) glassInfo.getThickness() * 10)); |
| | | //修改磨边对列中的磨边线路及状态 |
| | | edgGlassTaskQueueInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskQueueInfo>() |
| | | .set(EdgGlassTaskQueueInfo::getLine, cell) |
| | | .set(EdgGlassTaskQueueInfo::getState, Const.EDG_GLASS_START) |
| | | .eq(EdgGlassTaskQueueInfo::getGlassId, glassId) |
| | | .eq(EdgGlassTaskQueueInfo::getState, Const.EDG_GLASS_BEFORE)); |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getLine, cell) |
| | | .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_START) |
| | | .set(EdgGlassTaskInfo::getUpdateTime, new Date()) |
| | | .eq(EdgGlassTaskInfo::getGlassId, glassId) |
| | | .eq(EdgGlassTaskInfo::getState, Const.EDG_GLASS_BEFORE)); |
| | | if (cell == 1) { |
| | | glassIdOne = glassId; |
| | | } else { |
| | |
| | | } |
| | | |
| | | private boolean intoTask(EdgStorageDeviceTask task, String tableName, int deviceId) { |
| | | Date startDate = new Date(); |
| | | log.info("开始执行进片任务,任务信息为:{},表名为:{},设备id:{},开始时间:{}", task, tableName, deviceId, startDate); |
| | | //获取玻璃的基本信息 |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn())); |
| | | if (null == glassInfo) { |
| | | log.info("进片玻璃信息不存在,玻璃id:{}", task.getGlassIdIn()); |
| | | Date endDate = new Date(); |
| | | log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.FALSE; |
| | | } |
| | | if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) { |
| | | log.info("玻璃id与上次相同,禁止进片"); |
| | | Date endDate = new Date(); |
| | | log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | |
| | | return Boolean.FALSE; |
| | | } |
| | | int firstLength = minTwoFirstLength; |
| | | int secondLength = minTwoSecondLength; |
| | | if (deviceId == 1) { |
| | | firstLength = minOneFirstLength; |
| | | secondLength = minOneSecondLength; |
| | | } |
| | | if (Math.max(glassInfo.getWidth(), glassInfo.getHeight()) < firstLength || Math.min(glassInfo.getWidth(), glassInfo.getHeight()) < secondLength) { |
| | | log.info("进片玻璃尺寸小于{}*{},禁止进笼玻璃id:{},尺寸为{}、{}", firstLength, secondLength, task.getGlassIdIn(), glassInfo.getWidth(), glassInfo.getHeight()); |
| | | Date endDate = new Date(); |
| | | log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.FALSE; |
| | | } |
| | | //获取当前进片玻璃id和进片格子 相同尺寸可以放下的格子 |
| | |
| | | .eq(EdgStorageCage::getDeviceId, deviceId) |
| | | .eq(EdgStorageCage::getEnableState, Const.SLOT_ON) |
| | | .ge(EdgStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight())).last("order by abs(slot - " + task.getCurrentCell() + ")")); |
| | | // //直通任务 |
| | | // if (flag && CollectionUtil.isNotEmpty(emptyList)) { |
| | | // return emptyList.get(0); |
| | | // } |
| | | if (CollectionUtil.isEmpty(storageCageList) || storageCageList.size() == 1) { |
| | | log.info("没有多余的空格子"); |
| | | Date endDate = new Date(); |
| | | log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.FALSE; |
| | | } |
| | | edgStorageCage = storageCageList.get(0); |
| | |
| | | task.setStartCell(edgStorageCage.getSlot()); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_IN); |
| | | edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | saveHistoryTask(task); |
| | | saveHistoryTask(task, deviceId); |
| | | //记录进片任务的玻璃id用于下次任务的比较,防止同一块玻璃重复执行 |
| | | if (deviceId == 1) { |
| | | glassInIdOne = task.getGlassIdIn(); |
| | | } else { |
| | | glassInIdTwo = task.getGlassIdIn(); |
| | | } |
| | | edgStorageCageService.update(new UpdateWrapper<EdgStorageCage>() |
| | | .setSql("remain_width = remain_width -" + (glassGap + Math.max(details.getWidth(), details.getHeight()))).eq("device_id", deviceId) |
| | | .eq("slot", task.getStartCell())); |
| | | Date endDate = new Date(); |
| | | log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | private boolean outTask(EdgStorageDeviceTask task, String tableName, int deviceId) { |
| | | Date startDate = new Date(); |
| | | log.info("开始执行出片/直通任务,任务信息为:{},表名为:{},设备id:{},开始时间:{}", task, tableName, deviceId, startDate); |
| | | EdgStorageCageDetails edgStorageCageDetails = null; |
| | | //笼内是版图相差是否超过阈值 |
| | | boolean flag = queryMaxMinDiff(threshold); |
| | | boolean flag = queryMaxMinDiffByDevice(threshold, deviceId); |
| | | if (flag) { |
| | | EdgStorageCageDetails minEdgDetails = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .inSql(EdgStorageCageDetails::getSlot, "select slot from edg_storage_cage where enable_state = " + Const.SLOT_ON) |
| | |
| | | } |
| | | if (edgStorageCageDetails == null && StringUtils.isNotBlank(task.getGlassIdIn())) { |
| | | //和上次任务不存在相同尺寸 |
| | | int firstLength = minTwoFirstLength; |
| | | int secondLength = minTwoSecondLength; |
| | | if (deviceId == 1) { |
| | | firstLength = minOneFirstLength; |
| | | secondLength = minOneSecondLength; |
| | | } |
| | | GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn())); |
| | | if (Math.max(glassInInfo.getWidth(), glassInInfo.getHeight()) < firstLength || Math.min(glassInInfo.getWidth(), glassInInfo.getHeight()) < secondLength) { |
| | | log.info("直通任务进片玻璃尺寸小于{}*{}", firstLength, secondLength); |
| | | return Boolean.FALSE; |
| | | } |
| | | edgStorageCageDetails = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInInfo, edgStorageCageDetails); |
| | | } |
| | |
| | | return Boolean.FALSE; |
| | | } |
| | | log.info("5、直通任务,将玻璃信息插入卧式理片笼,当前玻璃信息:{}", edgStorageCageDetails); |
| | | if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) { |
| | | log.info("玻璃id与上次相同,禁止进片"); |
| | | return Boolean.FALSE; |
| | | } |
| | | //玻璃信息替换 |
| | | String glassIdChange = queryAndChangeGlass(glassId); |
| | | //处理在卧理内的玻璃信息:笼内的数据处理 |
| | |
| | | task.setTaskRunning(taskType); |
| | | |
| | | edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | saveHistoryTask(task); |
| | | saveHistoryTask(task, deviceId); |
| | | //记录直通任务的玻璃id用于下次任务的比较,防止同一块玻璃重复执行 |
| | | if (3 == task.getTaskState()) { |
| | | if (deviceId == 1) { |
| | | glassInIdOne = edgStorageCageDetails.getGlassId(); |
| | | } else { |
| | | glassInIdTwo = edgStorageCageDetails.getGlassId(); |
| | | } |
| | | } |
| | | //更新详情表任务出片中 |
| | | edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>() |
| | | .set(EdgStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .eq(EdgStorageCageDetails::getGlassId, edgStorageCageDetails.getGlassId())); |
| | | //磨边对列表新增一条数据 |
| | | EdgGlassTaskQueueInfo edgInfo = new EdgGlassTaskQueueInfo(); |
| | | BeanUtils.copyProperties(task, edgInfo); |
| | | edgInfo.setGlassId(edgStorageCageDetails.getGlassId()); |
| | | edgInfo.setCreateTime(new Date()); |
| | | edgInfo.setWidth((int) edgStorageCageDetails.getWidth()); |
| | | edgInfo.setHeight((int) edgStorageCageDetails.getHeight()); |
| | | edgInfo.setThickness((int) edgStorageCageDetails.getThickness()); |
| | | edgInfo.setState(Const.EDG_GLASS_BEFORE); |
| | | edgGlassTaskQueueInfoService.save(edgInfo); |
| | | saveGlassSize(edgStorageCageDetails); |
| | | // edgStorageCageService.update(new UpdateWrapper<EdgStorageCage>() |
| | | // .setSql("remain_width = remain_width +" + Math.max(edgStorageCageDetails.getWidth(), edgStorageCageDetails.getHeight())) |
| | | // .eq("device_id", deviceId) |
| | | // .eq("slot", task.getStartCell())); |
| | | Date endDate = new Date(); |
| | | log.info("结束出片/直通任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | private boolean finishTask(EdgStorageDeviceTask task, String tableName) { |
| | | log.info("当前任务信息为:{}", task); |
| | | if (task.getTaskState() <= 4 && task.getTaskRunning() == 0) { |
| | | if (task.getTaskState() <= 4) { |
| | | log.info("有正在执行的任务或这任务已执行任务状态{},任务启动情况{},结束", task.getTaskState(), task.getTaskRunning()); |
| | | return Boolean.FALSE; |
| | | } |
| | | Date startDate = new Date(); |
| | | log.info("开始执行完成任务后清除动作,任务信息为:{},表名为:{},开始时间:{}", task, tableName, startDate); |
| | | Integer cell = task.getStartCell(); |
| | | Integer state = task.getTaskState(); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY); |
| | | task.setGlassIdOut(""); |
| | | task.setStartCell(0); |
| | | edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | |
| | | EdgStorageDeviceTaskHistory taskHistory = edgStorageDeviceTaskHistoryService.getOne(new LambdaQueryWrapper<EdgStorageDeviceTaskHistory>() |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .orderByDesc(EdgStorageDeviceTaskHistory::getCreateTime).last("limit 1")); |
| | | int device = tableName.equals("edg_storage_device_one_task") ? 1 : 2; |
| | | updateCellRemainWidth(cell, device, taskHistory); |
| | | edgStorageDeviceTaskHistoryService.update(new LambdaUpdateWrapper<EdgStorageDeviceTaskHistory>() |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .set(EdgStorageDeviceTaskHistory::getTaskState, |
| | | Const.GLASS_CACHE_TYPE_FINISH.equals(state) ? Const.RAW_GLASS_TASK_SUCCESS : Const.RAW_GLASS_TASK_FAILURE) |
| | | ); |
| | | int device = tableName.equals("edg_storage_device_one_task") ? 1 : 2; |
| | | updateCellRemainWidth(cell, device); |
| | | //最后更新任务,保证任务前的动作都做完 |
| | | edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | Date endDate = new Date(); |
| | | log.info("结束完成任务后清除动作,表名为:{},结束时间为:{},共耗时:{}ms", tableName, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | |
| | | "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight() |
| | | + " and state != 100") |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderBy(Boolean.TRUE, Boolean.TRUE, GlassInfo::getTemperingFeedSequence) |
| | | .orderByAsc(GlassInfo::getTemperingFeedSequence) |
| | | .last("Limit 1"); |
| | | GlassInfo swapGlassInfo = glassInfoService.getOne(queryWrapper); |
| | | if (swapGlassInfo != null && !glassInfo.getGlassId().equals(swapGlassInfo.getGlassId())) { |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public boolean queryMaxMinDiff(int threshold) { |
| | | public boolean queryMaxMinDiffByDevice(int threshold, int deviceId) { |
| | | //获取笼子内最大版图id和最小版图id插值,判断是否大于阈值,大于阈值直接出最小版图玻璃 |
| | | QueryWrapper<EdgStorageCageDetails> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("max(tempering_layout_id)-min(tempering_layout_id) as diff") |
| | | .eq("state", Const.GLASS_STATE_IN) |
| | | .eq("device_id", deviceId) |
| | | .inSql("slot", "select slot from edg_storage_cage where enable_state = " + Const.SLOT_ON); |
| | | List<Object> list = edgStorageCageDetailsService.listObjs(queryWrapper); |
| | | //获取笼内玻璃版图差值是否大于阈值 |
| | |
| | | } |
| | | } |
| | | |
| | | public boolean saveHistoryTask(EdgStorageDeviceTask task) { |
| | | public boolean saveHistoryTask(EdgStorageDeviceTask task, int deviceId) { |
| | | EdgStorageDeviceTaskHistory taskHistory = new EdgStorageDeviceTaskHistory(); |
| | | BeanUtils.copyProperties(task, taskHistory); |
| | | taskHistory.setTaskType(task.getTaskRunning()); |
| | | taskHistory.setCreateTime(new Date()); |
| | | taskHistory.setTaskState(Const.RAW_GLASS_TASK_NEW); |
| | | taskHistory.setDeviceId(deviceId); |
| | | edgStorageDeviceTaskHistoryService.save(taskHistory); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | private boolean updateCellRemainWidth(int slot, int device) { |
| | | private boolean updateCellRemainWidth(int slot, int device, EdgStorageDeviceTaskHistory taskHistory) { |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot, slot) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | int remainWidth = cellLength; |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | int widthTotal = (int) list.stream().map(e -> Math.max(e.getWidth(), e.getHeight()) + glassGap).mapToDouble(Double::intValue).sum(); |
| | | remainWidth = cellLength - widthTotal >= 0 ? cellLength - widthTotal : 0; |
| | | if (2 == taskHistory.getTaskType()) { |
| | | remainWidth = 0; |
| | | } else { |
| | | EdgStorageCage storageCage = edgStorageCageService.getOne(new LambdaQueryWrapper<EdgStorageCage>() |
| | | .eq(EdgStorageCage::getDeviceId, device).eq(EdgStorageCage::getSlot, slot)); |
| | | EdgStorageCageDetails bigDetails = list.stream().filter(e -> e.getGlassId().equals(taskHistory.getGlassIdIn())).findFirst().orElse(null); |
| | | remainWidth = storageCage.getRemainWidth() - glassGap - (int) Math.max(bigDetails.getWidth(), bigDetails.getHeight()); |
| | | if (remainWidth <= 0) { |
| | | remainWidth = 0; |
| | | } |
| | | } |
| | | } |
| | | edgStorageCageService.update(new LambdaUpdateWrapper<EdgStorageCage>(). |
| | | set(EdgStorageCage::getRemainWidth, remainWidth).eq(EdgStorageCage::getSlot, slot).eq(EdgStorageCage::getDeviceId, device)); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | private boolean saveGlassSize(EdgStorageCageDetails glassInfo) { |
| | | EdgGlassTaskInfo edgGlassTaskInfo = new EdgGlassTaskInfo(); |
| | | BeanUtils.copyProperties(glassInfo, edgGlassTaskInfo); |
| | | edgGlassTaskInfo.setHeight((int) (glassInfo.getHeight() * ratio)); |
| | | edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio)); |
| | | edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio)); |
| | | edgGlassTaskInfo.setState(Const.EDG_GLASS_BEFORE); |
| | | edgGlassTaskInfo.setCreateTime(new Date()); |
| | | edgGlassTaskInfo.setUpdateTime(new Date()); |
| | | //先将历史对列表中本玻璃的数据删除,重新新增一份最新的数据 |
| | | edgGlassTaskInfoService.remove(new LambdaQueryWrapper<EdgGlassTaskInfo>().eq(EdgGlassTaskInfo::getGlassId, glassInfo.getGlassId())); |
| | | return edgGlassTaskInfoService.save(edgGlassTaskInfo); |
| | | } |
| | | |
| | | private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) { |
| | | return ReadWriteEntity.builder() |
| | | .identifier(identifier) |
| | |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 设备信息 |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://192.168.2.100:1433;databasename=mes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | application: |
| | | name: cacheGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | current_cell = #{task.currentCell}, |
| | | start_cell = #{task.startCell}, |
| | | end_cell = #{task.endCell} |
| | | <if test="task.taskState == 0"> |
| | | ,task_state = #{task.taskState} |
| | | </if> |
| | | </update> |
| | | </mapper> |
| | |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cacheVerticalGlass</artifactId> |
| | | <artifactId>cacheVerticalGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
| | |
| | | return Result.build(200, "查询成功", bigStorageCageDetailsService.selectTemperingGlass()); |
| | | } |
| | | |
| | | @ApiOperation("是否调度开关") |
| | | @PostMapping("/dispatchSwitch") |
| | | public Result dispatchSwitch(Boolean flag) { |
| | | bigStorageCageDetailsService.dispatchSwitch(flag); |
| | | return Result.build(200, "修改成功", redisUtil.getCacheObject("dispatchSwitch")); |
| | | } |
| | | |
| | | @ApiOperation("是否钢化开关") |
| | | @PostMapping("/temperingSwitch") |
| | | public Result temperingSwitch(Boolean flag) { |
| New file |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * (BigStorageGlassInfo)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:15:34 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("bigStorageGlassInfo") |
| | | public class BigStorageGlassInfoController { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * (BigStorageGlassRelationInfo)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:17:42 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("bigStorageGlassRelationInfo") |
| | | public class BigStorageGlassRelationInfoController { |
| | | |
| | | } |
| | | |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private double thickness; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | * x坐标 |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图id", position = 12) |
| | | private Integer temperingLayoutId; |
| | | @ApiModelProperty(value = "x坐标", position = 13) |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | * y坐标 |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图片序", position = 13) |
| | | private Integer temperingFeedSequence; |
| | | @ApiModelProperty(value = "y坐标", position = 14) |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 状态 |
| | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | @ApiModelProperty(value = "工程号", position = 16) |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | @ApiModelProperty(value = "层", position = 17) |
| | | private int layer; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 进片任务 |
| | | */ |
| | | @ApiModelProperty(value = "进片任务", position = 18) |
| New file |
| | |
| | | package com.mes.bigstorage.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * (BigStorageGlassInfo)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:15:35 |
| | | */ |
| | | @Data |
| | | public class BigStorageGlassInfo { |
| | | /** |
| | | * /*大理片笼信息表id |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * /*玻璃id |
| | | */ |
| | | private String glassId; |
| | | /** |
| | | * /*流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * /*玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | /** |
| | | * /*宽 |
| | | */ |
| | | private Double width; |
| | | /** |
| | | * /*高 |
| | | */ |
| | | private Double height; |
| | | /** |
| | | * /*厚度 |
| | | */ |
| | | private Double thickness; |
| | | /** |
| | | * /*钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | /** |
| | | * /*钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | /** |
| | | * /*x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | /** |
| | | * /*y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | private String engineerId; |
| | | /** |
| | | * /*层号 |
| | | */ |
| | | private Integer layer; |
| | | /** |
| | | * /*虚拟格子号 |
| | | */ |
| | | private Integer virtualSlot; |
| | | /** |
| | | * /*格子次序 |
| | | */ |
| | | private Integer slotSequence; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.bigstorage.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * (BigStorageGlassRelationInfo)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:17:43 |
| | | */ |
| | | @Data |
| | | public class BigStorageGlassRelationInfo { |
| | | /** |
| | | * /*钢化玻璃关系表id |
| | | */ |
| | | private Long id; |
| | | |
| | | private String engineerId; |
| | | /** |
| | | * /*玻璃id |
| | | */ |
| | | private String glassId; |
| | | /** |
| | | * /*钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | /** |
| | | * /*钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | /** |
| | | * /*虚拟格子 |
| | | */ |
| | | private Integer virtualSlot; |
| | | /** |
| | | * /*格子内次序 |
| | | */ |
| | | private Integer slotSequence; |
| | | /** |
| | | * /*实际笼子号 |
| | | */ |
| | | private Integer deviceId; |
| | | /** |
| | | * /*实际格子号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | |
| | | } |
| | | |
| File was renamed from hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageDTO.java |
| | |
| | | package com.mes.bigstorage.entity; |
| | | package com.mes.bigstorage.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | |
| | | * 笼子号 |
| | | */ |
| | | private Integer deviceId; |
| | | /** |
| | | * 序号 |
| | | */ |
| | | private Integer slotSequence; |
| | | } |
| New file |
| | |
| | | package com.mes.bigstorage.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/25 18:53 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class BigStorageRelationDTO { |
| | | |
| | | |
| | | private String engineerId; |
| | | /** |
| | | * /*钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | /** |
| | | * /*虚拟格子 |
| | | */ |
| | | private Integer virtualSlot; |
| | | |
| | | } |
| New file |
| | |
| | | package com.mes.bigstorage.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/25 18:53 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class BigStorageSequenceDTO { |
| | | |
| | | private Integer slot; |
| | | private Integer maxSequence; |
| | | private Integer minSequence; |
| | | |
| | | } |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.BigStorageRelationDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.SlotSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; |
| | |
| | | void updateBySlot(@Param(value = "list") List<UpdateBigStorageCageDTO> glassList, @Param(value = "state") int state); |
| | | |
| | | List<Map<String, Object>> selectTemperingGlassCount(); |
| | | |
| | | List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot(); |
| | | |
| | | List<BigStorageSequenceDTO> queryNeedDispatchSlot(BigStorageRelationDTO bigStorageRelationDTO); |
| | | } |
| New file |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageGlassInfo; |
| | | |
| | | /** |
| | | * (BigStorageGlassInfo)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:15:34 |
| | | */ |
| | | public interface BigStorageGlassInfoMapper extends BaseMapper<BigStorageGlassInfo> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageGlassRelationInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (BigStorageGlassRelationInfo)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:17:43 |
| | | */ |
| | | public interface BigStorageGlassRelationInfoMapper extends BaseMapper<BigStorageGlassRelationInfo> { |
| | | |
| | | List<String> queryNeedOutGlassId(@Param("engineerId") String engineerId, @Param("temperingLayoutId") Integer temperingLayoutId, @Param("temperingFeedSequence") Integer temperingFeedSequence); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.SlotSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstorage.entity.dto.*; |
| | | import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | |
| | | String temperingSwitch(Boolean flag); |
| | | |
| | | void appointEngineerId(String engineerId); |
| | | |
| | | List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot(); |
| | | |
| | | List<BigStorageSequenceDTO> dispatchBigStorageGlassInfo(BigStorageRelationDTO bigStorageRelationDTO); |
| | | |
| | | String dispatchSwitch(Boolean flag); |
| | | } |
| New file |
| | |
| | | package com.mes.bigstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageGlassInfo; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | |
| | | /** |
| | | * (BigStorageGlassInfo)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:15:35 |
| | | */ |
| | | public interface BigStorageGlassInfoService extends IService<BigStorageGlassInfo> { |
| | | |
| | | /** |
| | | * 按照玻璃id获取中空目标格子 |
| | | * |
| | | * @return |
| | | */ |
| | | BigStorageDTO queryBigStorageTargetSlot(String engineerId, Integer temperingLayoutId, Integer temperingFeedSequence); |
| | | |
| | | /** |
| | | * 生成中空玻璃信息 |
| | | */ |
| | | void generateBigStorageGlassInfo(String engineerId, int temperingLayoutId); |
| | | |
| | | /** |
| | | * 格子配对 |
| | | * |
| | | * @param bigStorageGlassInfo |
| | | * @return |
| | | */ |
| | | int bigStorageSlotPair(BigStorageGlassInfo bigStorageGlassInfo); |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.bigstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageGlassRelationInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (BigStorageGlassRelationInfo)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:17:43 |
| | | */ |
| | | public interface BigStorageGlassRelationInfoService extends IService<BigStorageGlassRelationInfo> { |
| | | |
| | | List<String> queryNeedOutGlassId(String engineerId, Integer temperingLayoutId, Integer temperingFeedSequence); |
| | | } |
| | | |
| | |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.SlotSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstorage.entity.dto.*; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | |
| | | } |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | // .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 engineer_id = '" + glassInfo.getEngineerId() + "' and tempering_layout_id = " + glassInfo.getTemperingLayoutId()) |
| | |
| | | } |
| | | for (Integer item : deviceUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String dispatchSwitch(Boolean flag) { |
| | | redisUtil.setCacheObject("dispatchSwitch", flag); |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public String temperingSwitch(Boolean flag) { |
| | | redisUtil.setCacheObject("temperingSwitch", flag); |
| | | return "success"; |
| | |
| | | public void appointEngineerId(String engineerId) { |
| | | redisUtil.setCacheObject("temperingengineerId", engineerId); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot() { |
| | | return baseMapper.queryIsAllNeedDispatchVirtualSlot(); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageSequenceDTO> dispatchBigStorageGlassInfo(BigStorageRelationDTO bigStorageRelationDTO) { |
| | | return baseMapper.queryNeedDispatchSlot(bigStorageRelationDTO); |
| | | } |
| | | } |
| | |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence); |
| | | List<GlassInfo> glassInfoList = glassInfoService.list(glassInfoWrapper); |
| | | if (glassInfoList.size() == Integer.parseInt(temperingNo.toString())) { |
| | | for (GlassInfo glassInfo : glassInfoList |
| | | ) { |
| | | |
| | | for (GlassInfo glassInfo : glassInfoList) { |
| | | TemperingGlassInfo temperingGlassInfo = new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(glassInfo, temperingGlassInfo); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | |
| | | } |
| | | key = true; |
| | | } |
| | |
| | | MPJLambdaWrapper<BigStorageCage> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.selectAll(BigStorageCage.class).selectCollection(BigStorageCageDetails.class, BigStorageCage::getBigStorageCageDetails) |
| | | .leftJoin(BigStorageCageDetails.class, on -> on.eq(BigStorageCageDetails::getSlot, BigStorageCage::getSlot) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN, Const.GLASS_STATE_ARTIFICIAL, Const.GLASS_STATE_OUT_ING)); |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).orderByAsc(BigStorageCageDetails::getUpdateTime)); |
| | | List<BigStorageCage> bigStorageCages = bigStorageCageMapper.selectJoinList(BigStorageCage.class, wrapper); |
| | | Map<Integer, List<BigStorageCage>> listMap = bigStorageCages.stream().collect(Collectors.groupingBy(item -> item.getDeviceId())); |
| | | return listMap; |
| New file |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageGlassInfo; |
| | | import com.mes.bigstorage.entity.BigStorageGlassRelationInfo; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.mapper.BigStorageGlassInfoMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstorage.service.BigStorageGlassInfoService; |
| | | import com.mes.bigstorage.service.BigStorageGlassRelationInfoService; |
| | | import com.mes.common.config.Const; |
| | | 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.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * (BigStorageGlassInfo)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:15:35 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class BigStorageGlassInfoServiceImpl extends ServiceImpl<BigStorageGlassInfoMapper, BigStorageGlassInfo> implements BigStorageGlassInfoService { |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | @Resource |
| | | BigStorageCageService bigStorageCageService; |
| | | @Resource |
| | | BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Resource |
| | | BigStorageGlassRelationInfoService bigStorageGlassRelationInfoService; |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Override |
| | | public BigStorageDTO queryBigStorageTargetSlot(String engineerId, Integer temperingLayoutId, Integer temperingFeedSequence) { |
| | | //按照玻璃信息获取关系表是否有对应的关系 |
| | | BigStorageGlassRelationInfo relationInfoOne = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>() |
| | | .eq(BigStorageGlassRelationInfo::getEngineerId, engineerId) |
| | | .eq(BigStorageGlassRelationInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(BigStorageGlassRelationInfo::getTemperingFeedSequence, temperingFeedSequence) |
| | | ); |
| | | if (relationInfoOne == null) { |
| | | //理片笼关系表中没有对应的数据,查看理片笼虚拟位置表是否有本工程下的所有玻璃虚拟信息 |
| | | BigStorageGlassInfo bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>() |
| | | .eq(BigStorageGlassInfo::getEngineerId, engineerId) |
| | | .eq(BigStorageGlassInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(BigStorageGlassInfo::getTemperingFeedSequence, temperingFeedSequence)); |
| | | if (null == bigStorageGlassInfo) { |
| | | //虚拟位置表没有本工程下的所有玻璃虚拟信息,按照玻璃id生成本工程下所有玻璃的虚拟信息 |
| | | generateBigStorageGlassInfo(engineerId, temperingLayoutId); |
| | | bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>() |
| | | .eq(BigStorageGlassInfo::getEngineerId, engineerId) |
| | | .eq(BigStorageGlassInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(BigStorageGlassInfo::getTemperingFeedSequence, temperingFeedSequence)); |
| | | } |
| | | //按照虚拟位置和大理片笼现有可用格子生成关系表 |
| | | bigStorageSlotPair(bigStorageGlassInfo); |
| | | //关系表获取实际位置 |
| | | relationInfoOne = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>() |
| | | .eq(BigStorageGlassRelationInfo::getEngineerId, engineerId) |
| | | .eq(BigStorageGlassRelationInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(BigStorageGlassRelationInfo::getTemperingFeedSequence, temperingFeedSequence)); |
| | | } |
| | | BigStorageCageDetails bigStorageCageDetails = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, relationInfoOne.getSlot()).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .orderByDesc(BigStorageCageDetails::getSequence).last("limit 1")); |
| | | if (null == bigStorageCageDetails) { |
| | | BigStorageDTO storageDTO = new BigStorageDTO(); |
| | | storageDTO.setDeviceId(relationInfoOne.getDeviceId()); |
| | | storageDTO.setSlot(relationInfoOne.getSlot()); |
| | | storageDTO.setSlotSequence(relationInfoOne.getSlotSequence()); |
| | | storageDTO.setWidth(slotWidth); |
| | | return storageDTO; |
| | | } |
| | | BigStorageGlassRelationInfo relationInfoBefore = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>() |
| | | .eq(BigStorageGlassRelationInfo::getEngineerId, relationInfoOne.getEngineerId()) |
| | | .eq(BigStorageGlassRelationInfo::getTemperingLayoutId, relationInfoOne.getTemperingLayoutId()) |
| | | .eq(BigStorageGlassRelationInfo::getVirtualSlot, relationInfoOne.getVirtualSlot()) |
| | | .eq(BigStorageGlassRelationInfo::getSlotSequence, relationInfoOne.getSlotSequence() - 1)); |
| | | BigStorageCage storageCage = null; |
| | | if (null == relationInfoBefore) { |
| | | //表示序号没有或者 序号为1又不是第一块来的 新开一格 |
| | | storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot).last("limit 1")); |
| | | } else { |
| | | BigStorageCageDetails beforeGlass = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .eq(BigStorageCageDetails::getEngineerId, relationInfoBefore.getEngineerId()) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, relationInfoBefore.getTemperingLayoutId()) |
| | | .eq(BigStorageCageDetails::getTemperingFeedSequence, relationInfoBefore.getTemperingFeedSequence()) |
| | | ); |
| | | if (null == beforeGlass) { |
| | | storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot).last("limit 1")); |
| | | } else { |
| | | storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getSlot, beforeGlass.getSlot())); |
| | | } |
| | | } |
| | | Assert.isTrue(null != storageCage, "没有空余的笼子存放玻璃"); |
| | | BigStorageDTO storageDTO = new BigStorageDTO(); |
| | | storageDTO.setDeviceId(storageCage.getDeviceId()); |
| | | storageDTO.setSlotSequence(relationInfoOne.getSlotSequence()); |
| | | storageDTO.setSlot(storageCage.getSlot()); |
| | | storageDTO.setWidth(storageCage.getRemainWidth()); |
| | | return storageDTO; |
| | | } |
| | | |
| | | @Override |
| | | public void generateBigStorageGlassInfo(String engineerId, int temperingLayoutId) { |
| | | List<BigStorageGlassInfo> list = this.list(new LambdaQueryWrapper<BigStorageGlassInfo>() |
| | | .eq(BigStorageGlassInfo::getEngineerId, engineerId).eq(BigStorageGlassInfo::getTemperingLayoutId, temperingLayoutId)); |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | return; |
| | | } |
| | | // Engineering engineering = engineeringMapper.selectOne(new LambdaQueryWrapper<Engineering>() |
| | | // .eq(Engineering::getEngineerId, glassInfo.getEngineerId())); |
| | | //获取玻璃的工程id,按照工程id获取工程下的所有玻璃信息 |
| | | List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getEngineerId, engineerId) |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId).orderByAsc(GlassInfo::getTemperingFeedSequence)); |
| | | Map<Integer, List<GlassInfo>> trmperingIdMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getTemperingLayoutId)); |
| | | List<BigStorageGlassInfo> bigStorageGlassInfoList = new ArrayList<>(); |
| | | //方式一:将玻璃按版图、版序 依次生成虚拟格子信息,格子一直往后累加 |
| | | trmperingIdMap.forEach((e, v) -> { |
| | | int remainWidth = slotWidth; |
| | | int slotNumber = 1; |
| | | int slotSequence = 1; |
| | | for (GlassInfo item : v) { |
| | | int maxLength = (int) Math.max(item.getWidth(), item.getHeight()); |
| | | if (remainWidth > maxLength && slotSequence <= outCarMaxSize) { |
| | | remainWidth = remainWidth - maxLength - glassGap; |
| | | } else { |
| | | slotNumber = slotNumber + 1; |
| | | slotSequence = 1; |
| | | remainWidth = slotWidth - maxLength - glassGap; |
| | | } |
| | | BigStorageGlassInfo bigStorage = new BigStorageGlassInfo(); |
| | | BeanUtils.copyProperties(item, bigStorage); |
| | | bigStorage.setVirtualSlot(slotNumber); |
| | | bigStorage.setSlotSequence(slotSequence++); |
| | | bigStorage.setId(null); |
| | | bigStorageGlassInfoList.add(bigStorage); |
| | | } |
| | | }); |
| | | this.saveBatch(bigStorageGlassInfoList); |
| | | log.info("分配完毕"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public int bigStorageSlotPair(BigStorageGlassInfo bigStorageGlassInfo) { |
| | | //获取所有空闲可用的格子号 |
| | | BigStorageCage storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot).last("limit 1")); |
| | | Assert.isTrue(null != storageCage, "没有空余的笼子存放玻璃"); |
| | | Integer slot = storageCage.getSlot(); |
| | | //获取该工程同一流程卡同一车的玻璃信息 |
| | | List<BigStorageGlassInfo> bigStorageGlassInfoList = this.list(new LambdaQueryWrapper<BigStorageGlassInfo>() |
| | | .eq(BigStorageGlassInfo::getEngineerId, bigStorageGlassInfo.getEngineerId()) |
| | | .eq(BigStorageGlassInfo::getTemperingLayoutId, bigStorageGlassInfo.getTemperingLayoutId()) |
| | | .eq(BigStorageGlassInfo::getVirtualSlot, bigStorageGlassInfo.getVirtualSlot())); |
| | | //设置关系表的实际格子号 |
| | | List<BigStorageGlassRelationInfo> relationInfoList = bigStorageGlassInfoList.stream().map(e -> { |
| | | BigStorageGlassRelationInfo info = new BigStorageGlassRelationInfo(); |
| | | BeanUtils.copyProperties(e, info); |
| | | info.setSlot(slot); |
| | | info.setDeviceId(storageCage.getDeviceId()); |
| | | return info; |
| | | }).collect(Collectors.toList()); |
| | | //保存关系表 |
| | | bigStorageGlassRelationInfoService.saveBatch(relationInfoList); |
| | | //返回格子信息 |
| | | return slot; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageGlassRelationInfo; |
| | | import com.mes.bigstorage.mapper.BigStorageGlassRelationInfoMapper; |
| | | import com.mes.bigstorage.service.BigStorageGlassRelationInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (BigStorageGlassRelationInfo)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-24 10:17:43 |
| | | */ |
| | | @Service |
| | | public class BigStorageGlassRelationInfoServiceImpl extends ServiceImpl<BigStorageGlassRelationInfoMapper, BigStorageGlassRelationInfo> implements BigStorageGlassRelationInfoService { |
| | | |
| | | @Override |
| | | public List<String> queryNeedOutGlassId(String engineerId, Integer temperingLayoutId, Integer temperingFeedSequence) { |
| | | return baseMapper.queryNeedOutGlassId(engineerId, temperingLayoutId, temperingFeedSequence); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | package com.mes.bigstoragetask.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | |
| | | import java.util.List; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | |
| | | package com.mes.edgglasstask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class EdgGlassTaskInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 磨边任务id |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | |
| | | @ApiModelProperty(value = "厚度", position = 5) |
| | | private Integer thickness; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | @ApiModelProperty(value = "玻璃类型", position = 6) |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | @ApiModelProperty(value = "状态", position = 7) |
| | | private Integer status; |
| | | @ApiModelProperty(value = "状态", position = 6) |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "线路", position = 8) |
| | | @ApiModelProperty(value = "线路", position = 7) |
| | | private Integer line; |
| | | |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "时间", position = 9) |
| | | private Date time; |
| | | @ApiModelProperty(value = "开始时间", position = 8) |
| | | private Date createTime; |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "更新时间", position = 9) |
| | | private Date updateTime; |
| | | |
| | | @TableLogic |
| | | private int deleted; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.mapper.EdgGlassTaskInfoMapper; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | |
| | | public int judgeTasktype(String plcFeedReqLine){ |
| | | LambdaQueryWrapper<EdgGlassTaskInfo> edgGlassTaskInfoWrapper=new LambdaQueryWrapper<>(); |
| | | edgGlassTaskInfoWrapper |
| | | .eq(EdgGlassTaskInfo::getLine,plcFeedReqLine) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | .eq(EdgGlassTaskInfo::getLine, plcFeedReqLine) |
| | | .orderByDesc(EdgGlassTaskInfo::getCreateTime); |
| | | EdgGlassTaskInfo edgGlassTaskInfo=baseMapper.selectOne(edgGlassTaskInfoWrapper); |
| | | double width=bigStorageCageDetailsService.selectGetBoard(plcFeedReqLine); |
| | | if(edgGlassTaskInfo.getWidth()<width){ |
| | |
| | | |
| | | LambdaQueryWrapper<EdgGlassTaskInfo> edgGlassTaskInfoWrapper=new LambdaQueryWrapper<>(); |
| | | edgGlassTaskInfoWrapper |
| | | .eq(EdgGlassTaskInfo::getLine,1) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | .eq(EdgGlassTaskInfo::getLine, 1) |
| | | .orderByDesc(EdgGlassTaskInfo::getCreateTime); |
| | | List<EdgGlassTaskInfo> edgGlassTaskInfoList1=baseMapper.selectList(edgGlassTaskInfoWrapper); |
| | | int i=0; |
| | | for (EdgGlassTaskInfo edgGlassTaskInfo:edgGlassTaskInfoList1 |
| | |
| | | } |
| | | |
| | | edgGlassTaskInfoWrapper |
| | | .eq(EdgGlassTaskInfo::getLine,2) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | .eq(EdgGlassTaskInfo::getLine, 2) |
| | | .orderByDesc(EdgGlassTaskInfo::getCreateTime); |
| | | List<EdgGlassTaskInfo> edgGlassTaskInfoList2=baseMapper.selectList(edgGlassTaskInfoWrapper); |
| | | i=0; |
| | | for (EdgGlassTaskInfo edgGlassTaskInfo:edgGlassTaskInfoList2 |
| New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageTask; |
| | | import com.mes.bigstoragecagetask.service.BigStorageCageTaskService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author SNG-015 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class OPCPlcSlicecage { |
| | | |
| | | @Resource |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Resource |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Resource |
| | | private BigStorageCageTaskService bigStorageCageTaskService; |
| | | |
| | | @Value("${mes.scan.ip}") |
| | | private String scanIp; |
| | | |
| | | @Value("${mes.scan.port}") |
| | | private Integer scanPort; |
| | | |
| | | private JSONObject jsonObject = new JSONObject(); |
| | | |
| | | public void queryDataSource1() throws InterruptedException { |
| | | List<Double> carPostion = new ArrayList<>(); |
| | | carPostion.add(0.25); |
| | | carPostion.add(0.5); |
| | | jsonObject.append("carPostion", carPostion); |
| | | //界面展示笼子信息 |
| | | jsonObject.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail()); |
| | | |
| | | //进片任务数据 |
| | | List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task"); |
| | | jsonObject.append("bigStorageCageDetailsFeedTask", inTaskList); |
| | | |
| | | //出片任务数据 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | jsonObject.append("bigStorageCageDetailsOutTask", outTaskList); |
| | | |
| | | //理片笼使用情况 |
| | | List<Map<String, Object>> bigStorageCageUsage = bigStorageCageService.selectBigStorageCageUsage(); |
| | | jsonObject.append("bigStorageCageUsage", bigStorageCageUsage); |
| | | |
| | | //理片笼表格信息 |
| | | jsonObject.append("bigStorageCageInfo", bigStorageCageService.querybigStorageCageDetailAll()); |
| | | |
| | | //钢化开关 |
| | | boolean temperingSwitch = false; |
| | | if (redisUtil.getCacheObject("temperingSwitch") == null) { |
| | | redisUtil.setCacheObject("temperingSwitch", false); |
| | | } else { |
| | | temperingSwitch = redisUtil.getCacheObject("temperingSwitch"); |
| | | } |
| | | jsonObject.append("temperingSwitch", temperingSwitch); |
| | | //打印开关 |
| | | boolean autoPrint = false; |
| | | if (redisUtil.getCacheObject("autoPrint") == null) { |
| | | redisUtil.setCacheObject("autoPrint", false); |
| | | } else { |
| | | autoPrint = redisUtil.getCacheObject("autoPrint"); |
| | | } |
| | | jsonObject.append("autoPrint", autoPrint); |
| | | |
| | | //当前指定工程 |
| | | String temperingengineerId = ""; |
| | | if (redisUtil.getCacheObject("temperingengineerId") == null) { |
| | | redisUtil.setCacheObject("temperingengineerId", temperingengineerId); |
| | | } else { |
| | | temperingengineerId = redisUtil.getCacheObject("temperingengineerId"); |
| | | } |
| | | jsonObject.append("temperingengineerId", temperingengineerId); |
| | | |
| | | |
| | | } |
| | | |
| | | public void queryDataSource2() throws InterruptedException { |
| | | //出片队列 |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list( |
| | | new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .inSql(TemperingGlassInfo::getEngineerId, "select distinct engineer_id from tempering_glass_info where state<4") |
| | | ); |
| | | jsonObject.append("temperingGlassInfoList", temperingGlassInfoList); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcStorageCageTask() throws InterruptedException { |
| | | jsonObject = new JSONObject(); |
| | | try { |
| | | //查询使用数据源1查询数据 |
| | | queryDataSource1(); |
| | | //查询使用数据源2查询数据 |
| | | queryDataSource2(); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("slicecage"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void temperingIsRun() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //进片任务数据 |
| | | List<BigStorageCageDetails> bigStorageCageDetailsFeedTask = bigStorageCageDetailsService.selectFeedTask(); |
| | | jsonObject.append("bigStorageCageDetailsFeedTask", bigStorageCageDetailsFeedTask); |
| | | //出片任务数据 |
| | | List<BigStorageCageDetails> bigStorageCageDetailsOutTask = bigStorageCageDetailsService.selectOutTask(); |
| | | jsonObject.append("bigStorageCageDetailsOutTask", bigStorageCageDetailsOutTask); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(fixedDelay = Long.MAX_VALUE) |
| | | public void scanCodeTask() { |
| | | log.info("扫描任务已启动"); |
| | | while (true) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try (Socket socket = new Socket(scanIp, scanPort); |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) { |
| | | // 接收服务器响应 |
| | | log.info("等待扫码中......"); |
| | | String glassId = in.readLine(); |
| | | log.info("扫描到的玻璃id:{}", glassId); |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("slicecage"); |
| | | if (CollectionUtils.isNotEmpty(sendwServer)) { |
| | | //按照玻璃id获取玻璃信息返回给前端界面,具体需要哪些数据待确认 |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getGlassId, glassId).last("limit 1")); |
| | | if (null == glassInfo) { |
| | | log.info("按照玻璃id:{},无法找到玻璃信息", glassId); |
| | | } else { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | jsonObject.append("scanGlass", glassInfo); |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception exception) { |
| | | log.info("读取异常,原因为{}", exception.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageRelationDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstorage.service.BigStorageGlassInfoService; |
| | | import com.mes.bigstorage.service.BigStorageGlassRelationInfoService; |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask; |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageTask; |
| | | import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService; |
| | | import com.mes.bigstoragecagetask.service.BigStorageCageTaskService; |
| | | import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author SNG-015 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class OpcPlcStorageCageNewTask { |
| | | @Resource |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Resource |
| | | private DamageService damageService; |
| | | @Resource |
| | | private GlassInfoService glassInfoService; |
| | | @Resource |
| | | private BigStorageGlassRelationInfoService bigStorageGlassRelationInfoService; |
| | | @Resource |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Resource |
| | | private BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService; |
| | | @Resource |
| | | private BigStorageCageTaskService bigStorageCageTaskService; |
| | | @Resource |
| | | private BigStorageGlassInfoService bigStorageGlassInfoService; |
| | | @Resource |
| | | private EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.carWidth}") |
| | | private Integer carWidth; |
| | | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Value("${mes.temperingOutTargetPosition}") |
| | | private Integer temperingOutTargetPosition; |
| | | @Value("${mes.artificialOutTargetPosition}") |
| | | private Integer artificialOutTargetPosition; |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束进片任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP1A.DLP1A.RequestMes"); |
| | | if (!"1".equals(requestEntity.getValue() + "")) { |
| | | log.info("当前未收到进片请求,结束进片任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity mesReplyEntity = miloService.readFromOpcUa("DLP1A.DLP1A.MesReply"); |
| | | if ("1".equals(mesReplyEntity.getValue() + "")) { |
| | | log.info("有正在执行的任务,结束进片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务信息 |
| | | List<BigStorageCageTask> inTaskList = new ArrayList(); |
| | | ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM1"); |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i); |
| | | if (null != requestWord.getValue()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | task.setGlassId(requestWord.getValue() + ""); |
| | | task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + "")); |
| | | inTaskList.add(task); |
| | | glassIdList.add(requestWord.getValue() + ""); |
| | | continue; |
| | | } |
| | | } |
| | | if (CollectionUtil.isEmpty(inTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束进片任务"); |
| | | return; |
| | | } |
| | | log.info("获取任务的玻璃id:{}", glassIdList); |
| | | Map<String, Long> glassCountMap = glassIdList.stream().collect(Collectors.groupingBy(e -> e, Collectors.counting())); |
| | | for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) { |
| | | if (entry.getValue() > 1) { |
| | | log.info("进片玻璃{}存在相同,结束本次任务", entry.getKey()); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | } |
| | | List<BigStorageCageDetails> detailsList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>().in(BigStorageCageDetails::getGlassId, glassIdList) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | if (CollectionUtil.isNotEmpty(detailsList)) { |
| | | log.info("理片笼存在相同的进片玻璃{},结束本次任务", detailsList); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList)); |
| | | |
| | | if (glassInfoList.size() != inTaskList.size()) { |
| | | log.info("进片任务数量{}与玻璃数量{}不匹配,结束本次进片", inTaskList.size(), glassInfoList.size()); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | //修改磨边对列表的玻璃状态 |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_SUCCESS).in(EdgGlassTaskInfo::getGlassId, glassIdList)); |
| | | Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId)); |
| | | //计算目标格子 |
| | | List<BigStorageCageHistoryTask> historyTasks = new ArrayList<>(); |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | BigStorageDTO bigStorageDTO = bigStorageGlassInfoService.queryBigStorageTargetSlot(info.getEngineerId(), info.getTemperingLayoutId(), info.getTemperingFeedSequence()); |
| | | //获取目标格子信息 |
| | | // BigStorageDTO bigStorageDTO = bigStorageCageDetailsService.queryTargetSlotByTempering(info); |
| | | // 临时更新格子的剩余尺寸:防止相邻玻璃进同一格子造成剩余尺寸不足,玻璃越界的情况,任务完成后再次更新大理片笼表剩余宽度(按照笼内玻璃数量更新大理片笼剩余尺寸) |
| | | bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>() |
| | | .set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) |
| | | .eq(BigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task); |
| | | //存放历史任务 |
| | | BigStorageCageHistoryTask historyTask = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | | historyTask.setTaskType(Const.BIG_STORAGE_BEFORE_IN); |
| | | historyTask.setGlassCount(glassInfoList.size()); |
| | | historyTask.setTaskState(Const.ENGINEERING_NEW); |
| | | historyTasks.add(historyTask); |
| | | BigStorageCageDetails cageDetails = new BigStorageCageDetails(); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setSlot(bigStorageDTO.getSlot()); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setDeviceId(bigStorageDTO.getDeviceId()); |
| | | cageDetails.setSequence(bigStorageDTO.getSlotSequence()); |
| | | cageDetails.setGap(glassGap); |
| | | cageDetails.setId(null); |
| | | bigStorageCageDetailsService.save(cageDetails); |
| | | } |
| | | //历史数据入库 |
| | | bigStorageCageHistoryTaskService.saveBatch(historyTasks); |
| | | //向opc发送启动信号 |
| | | List<ReadWriteEntity> list = new ArrayList<>(); |
| | | for (int i = 1; i <= inTaskList.size(); i++) { |
| | | list.add(generateReadWriteEntity("DLP1A.DLP1A.TO" + i, inTaskList.get(i - 1).getTargetSlot())); |
| | | } |
| | | list.add(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 1)); |
| | | miloService.writeToOpcWord(list); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void outBigStorageTask() throws Exception { |
| | | Date startDate = new Date(); |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束进片任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP1B.DLP1B.RequestMes"); |
| | | if (!"1".equals(requestEntity.getValue() + "")) { |
| | | log.info("当前未收到出片请求,结束出片任务"); |
| | | return; |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | | } |
| | | //是否允许钢化 |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | 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(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_OUT) |
| | | // .in(BigStorageCageHistoryTask::getGlassId, glassIdList)); |
| | | // List<TemperingGlassInfo> temperingGlassList = unFinishTemperingGlassInfoList; |
| | | // if (CollectionUtil.isNotEmpty(historyTaskList)) { |
| | | // List<String> taskGlassList = historyTaskList.stream().map(BigStorageCageHistoryTask::getGlassId).collect(Collectors.toList()); |
| | | // temperingGlassList = unFinishTemperingGlassInfoList.stream().filter(e -> !taskGlassList.contains(e.getGlassId())).collect(Collectors.toList()); |
| | | // } |
| | | // if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfoByVirtualSlot(unFinishTemperingGlassInfoList, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | if (redisUtil.getCacheObject("temperingSwitch")) { |
| | | //钢化优先:获取理片笼 玻璃小片 破损表 数量 判断笼内版图是否到齐 |
| | | List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll(); |
| | | if (CollectionUtil.isNotEmpty(temperingLayoutDTOList)) { |
| | | //玻璃到齐包括已出片的 |
| | | //到齐,将玻璃小片数据存入钢化小片表,逻辑生成出片任务 结束 |
| | | for (TemperingLayoutDTO item : temperingLayoutDTOList) { |
| | | // if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) { |
| | | 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(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId()) |
| | | .eq(GlassInfo::getEngineerId, item.getEngineerId()) |
| | | .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); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | //是否有人工下片任务 有直接出 |
| | | List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL) |
| | | .orderByAsc(BigStorageCageDetails::getSlot) |
| | | .orderByAsc(BigStorageCageDetails::getId).last("limit " + outCarMaxSize)); |
| | | if (CollectionUtil.isNotEmpty(artificialList)) { |
| | | computeOutGlassInfoByVirtualSlot(artificialList, "big_storage_cage_out_one_task", artificialOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | | if (redisUtil.getCacheObject("dispatchSwitch")) { |
| | | //todo:获取笼内单格已经到齐的玻璃格子信息 |
| | | List<BigStorageRelationDTO> virtualList = bigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot(); |
| | | if (CollectionUtil.isEmpty(virtualList)) { |
| | | log.info("没有需要调度的格子"); |
| | | return; |
| | | } |
| | | List<BigStorageCageDetails> list = new ArrayList<>(); |
| | | loop: |
| | | for (BigStorageRelationDTO dto : virtualList) { |
| | | List<BigStorageSequenceDTO> sequenceDTOList = bigStorageCageDetailsService.dispatchBigStorageGlassInfo(dto); |
| | | if (CollectionUtil.isEmpty(sequenceDTOList) || sequenceDTOList.size() == 1) { |
| | | continue; |
| | | } |
| | | int sequence = -1; |
| | | int startSlot = -1; |
| | | for (BigStorageSequenceDTO item : sequenceDTOList) { |
| | | if (item.getMinSequence() == sequence + 1) { |
| | | //生成调度任务 |
| | | int targetSlot = item.getSlot(); |
| | | list = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(BigStorageCageDetails::getSlot, startSlot)); |
| | | computeOutGlassInfoByVirtualSlot(list, "big_storage_cage_out_one_task", targetSlot, Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_BEFORE_DISPATCH); |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | slotList.add(targetSlot); |
| | | updateSlotRemainBySlots(slotList); |
| | | break loop; |
| | | } |
| | | sequence = item.getMaxSequence(); |
| | | startSlot = item.getSlot(); |
| | | } |
| | | } |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishInBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束完成进片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | // List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task"); |
| | | List<BigStorageCageTask> inTaskList = new ArrayList(); |
| | | |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | ReadWriteEntity toWord = miloService.readFromOpcUa("DLP1A.DLP1A.TO1"); |
| | | if ("0".equals(toWord.getValue() + "")) { |
| | | log.info("完成任务已执行,结束本次完成进片任务"); |
| | | return; |
| | | } |
| | | for (int i = 1; i <= 6; i++) { |
| | | ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i); |
| | | ReadWriteEntity statetWord = miloService.readFromOpcUa("DLP1A.DLP1A.STATE" + i); |
| | | ReadWriteEntity toOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.TO" + i); |
| | | ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM" + i); |
| | | |
| | | if (null != requestWord.getValue()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | task.setGlassId(requestWord.getValue() + ""); |
| | | task.setTargetSlot(Integer.parseInt(toOpcUa.getValue() + "")); |
| | | task.setTaskState(Integer.parseInt(statetWord.getValue() + "")); |
| | | task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + "")); |
| | | inTaskList.add(task); |
| | | glassIdList.add(requestWord.getValue() + ""); |
| | | continue; |
| | | } |
| | | } |
| | | if (CollectionUtil.isEmpty(inTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = inTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(unFinishTaskList)) { |
| | | log.info("存在未完成的玻璃信息,玻璃:{}", unFinishTaskList); |
| | | return; |
| | | } |
| | | Map<Integer, List<BigStorageCageTask>> taskMap = inTaskList.stream().collect(Collectors.groupingBy(BigStorageCageTask::getTaskState)); |
| | | //按照任务状态修改大理片笼内的玻璃数据 |
| | | // 重新计算大理片笼内的剩余尺寸 |
| | | taskMap.forEach((e1, v) -> { |
| | | if (e1 == 2) { |
| | | //进片完成 |
| | | log.info("3、获取进片已完成的玻璃信息id:{}", v); |
| | | List<Integer> inSuccessGlassSlot = v.stream().map(BigStorageCageTask::getTargetSlot).collect(Collectors.toList()); |
| | | List<UpdateBigStorageCageDTO> storageCageDTOList = v.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:{}", v); |
| | | updateSlotRemainBySlots(inSuccessGlassSlot); |
| | | } else if (e1 == 3) { |
| | | //破损处理 |
| | | dealDamageInTask(v); |
| | | } else { |
| | | //清空理片笼空数据 |
| | | noDealInTask(v); |
| | | } |
| | | }); |
| | | for (BigStorageCageTask item : inTaskList) { |
| | | //更新历史任务表中的任务状态 |
| | | bigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<BigStorageCageHistoryTask>() |
| | | .set(BigStorageCageHistoryTask::getTaskState, item.getTaskState()) |
| | | .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_IN) |
| | | .eq(BigStorageCageHistoryTask::getTargetSlot, item.getTargetSlot()) |
| | | .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | item.setTargetSlot(0); |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | } |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | //向opc发送启动信号 |
| | | List<ReadWriteEntity> list = new ArrayList<>(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | list.add(generateReadWriteEntity("DLP1A.DLP1A.TO" + i, 0)); |
| | | } |
| | | list.add(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 0)); |
| | | miloService.writeToOpcWord(list); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishOutBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束完成出片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = outTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(unFinishTaskList)) { |
| | | log.info("存在未完成的玻璃信息,玻璃:{}", unFinishTaskList); |
| | | return; |
| | | } |
| | | Map<Integer, List<BigStorageCageTask>> taskMap = outTaskList.stream().collect(Collectors.groupingBy(BigStorageCageTask::getTaskState)); |
| | | int taskType = 0; |
| | | if (Const.OUT_TARGET_POSITION_ALL.contains(outTaskList.get(0).getTargetSlot())) { |
| | | taskType = Const.BIG_STORAGE_BEFORE_OUT; |
| | | } else { |
| | | taskType = Const.BIG_STORAGE_BEFORE_DISPATCH; |
| | | } |
| | | //按照任务状态修改大理片笼内的玻璃数据 |
| | | // 重新计算大理片笼内的剩余尺寸 |
| | | Integer finalTaskType = taskType; |
| | | taskMap.forEach((e1, v) -> { |
| | | if (e1 == 2) { |
| | | //进片完成 |
| | | log.info("3、获取进片已完成的玻璃信息id:{}", v); |
| | | List<Integer> outSuccessGlassSlot = new ArrayList<>(); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_BEFORE_OUT)) { |
| | | outSuccessGlassSlot = v.stream().map(BigStorageCageTask::getStartSlot).collect(Collectors.toList()); |
| | | } else { |
| | | List<Integer> targetSuccessGlassSlot = v.stream().map(BigStorageCageTask::getTargetSlot).collect(Collectors.toList()); |
| | | List<Integer> startoutSuccessGlassSlot = v.stream().map(BigStorageCageTask::getStartSlot).collect(Collectors.toList()); |
| | | outSuccessGlassSlot.addAll(targetSuccessGlassSlot); |
| | | outSuccessGlassSlot.addAll(startoutSuccessGlassSlot); |
| | | } |
| | | List<UpdateBigStorageCageDTO> storageCageDTOList = v.stream().map(e -> { |
| | | UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO(); |
| | | storageCageDTO.setGlassId(e.getGlassId()); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_BEFORE_OUT)) { |
| | | storageCageDTO.setTargetSlot(e.getStartSlot()); |
| | | } else { |
| | | storageCageDTO.setTargetSlot(e.getTargetSlot()); |
| | | } |
| | | return storageCageDTO; |
| | | }).collect(Collectors.toList()); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_BEFORE_OUT)) { |
| | | bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT); |
| | | } else { |
| | | bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN); |
| | | } |
| | | log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", v); |
| | | updateSlotRemainBySlots(outSuccessGlassSlot); |
| | | } else if (e1 == 3) { |
| | | //破损处理 |
| | | dealDamageOutTask(v); |
| | | } else { |
| | | //清空理片笼空数据 |
| | | noDealOutTask(v); |
| | | } |
| | | }); |
| | | for (BigStorageCageTask item : outTaskList) { |
| | | //更新历史任务表中的任务状态 |
| | | bigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<BigStorageCageHistoryTask>() |
| | | .set(BigStorageCageHistoryTask::getTaskState, item.getTaskState()) |
| | | .eq(BigStorageCageHistoryTask::getTaskType, taskType) |
| | | .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | //更新钢化小片表 |
| | | Integer taskState = item.getTaskState(); |
| | | if (taskState == 2) { |
| | | temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .set(TemperingGlassInfo::getState, Const.TEMPERING_OUT).eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | } else if (taskState == 3) { |
| | | // temperingGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .set(TemperingGlassInfo::getState, Const.TEMPERING_DAMAGE |
| | | ).eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | |
| | | } else { |
| | | // 空执行 |
| | | } |
| | | } |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task"); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 0)); |
| | | } |
| | | |
| | | private void dealDamageInTask(List<BigStorageCageTask> damageTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", damageTaskList); |
| | | //移除理片笼详情表任务执行过程中破损的玻璃 |
| | | bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW) |
| | | .in(BigStorageCageDetails::getGlassId, damageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()))); |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : damageTaskList) { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(item.getGlassId()); |
| | | damage.setLine(item.getStartSlot()); |
| | | damage.setWorkingProcedure("磨边"); |
| | | damage.setRemark("进笼前卧转立"); |
| | | damage.setStatus(1); |
| | | damage.setType(item.getTaskState()); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(item.getTargetSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("进片任务-破损任务执行完成"); |
| | | } |
| | | |
| | | private void dealDamageOutTask(List<BigStorageCageTask> damageTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", damageTaskList); |
| | | //移除理片笼详情表任务执行过程中破损的玻璃 |
| | | bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .in(BigStorageCageDetails::getGlassId, damageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()))); |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : damageTaskList) { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(item.getGlassId()); |
| | | damage.setLine(item.getStartSlot()); |
| | | damage.setWorkingProcedure("钢化前"); |
| | | damage.setRemark("进笼后卧转立"); |
| | | damage.setStatus(1); |
| | | damage.setType(item.getTaskState()); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(item.getTargetSlot()); |
| | | slotList.add(item.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("出片任务-破损任务执行完成"); |
| | | } |
| | | |
| | | private void noDealInTask(List<BigStorageCageTask> noDealTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", noDealTaskList); |
| | | //移除理片笼详情表未执行任务的空记录信息 |
| | | bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW) |
| | | .in(BigStorageCageDetails::getGlassId, noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()))); |
| | | //记录格子号,按格子号更新剩余尺寸 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : noDealTaskList) { |
| | | slotList.add(item.getTargetSlot()); |
| | | slotList.add(item.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("进片任务-无动作执行完成"); |
| | | } |
| | | |
| | | private void noDealOutTask(List<BigStorageCageTask> noDealTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", noDealTaskList); |
| | | if (Const.OUT_TARGET_POSITION_ALL.contains(noDealTaskList.get(0).getTargetSlot())) { |
| | | //出片任务:将出片中状态恢复为在笼内 |
| | | List<String> glassList = noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(BigStorageCageDetails::getGlassId, glassList)); |
| | | |
| | | } else { |
| | | //调度任务:将调度中状态改为在笼内,格子号恢复为调度前的格子 |
| | | for (BigStorageCageTask item : noDealTaskList) { |
| | | bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getSlot, item.getStartSlot()) |
| | | .set(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .eq(BigStorageCageDetails::getGlassId, item.getGlassId())); |
| | | } |
| | | } |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : noDealTaskList) { |
| | | slotList.add(item.getTargetSlot()); |
| | | slotList.add(item.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("出片任务-无动作执行完成"); |
| | | } |
| | | |
| | | /** |
| | | * 出片一次仅生成一车玻璃 |
| | | * |
| | | * @param list |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfoByVirtualSlot(List<T> list, String tableName, int targetSlot, int state, int taskType) { |
| | | //任务数据:获取车子存放玻璃最大数量,玻璃间隔 |
| | | List<String> glassIdList = bigStorageGlassRelationInfoService.queryNeedOutGlassId( |
| | | list.get(0).getEngineerId(), list.get(0).getTemperingLayoutId(), list.get(0).getTemperingFeedSequence()); |
| | | List<T> outGlassList = list.stream().filter(e -> glassIdList.contains(e.getGlassId())).collect(Collectors.toList()); |
| | | Assert.isFalse(CollectionUtil.isEmpty(outGlassList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", outGlassList.size()); |
| | | List<BigStorageCageTask> bigStorageCageTaskList = outGlassList.stream() |
| | | .map(e -> new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot, 0)).collect(Collectors.toList()); |
| | | |
| | | List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | int glassCount = bigStorageCageTaskList.size(); |
| | | //生成出片任务条数不足6补全 |
| | | while (bigStorageCageTaskList.size() < 6) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | List<BigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | BigStorageCageHistoryTask history = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(e, history); |
| | | history.setGlassCount(glassCount); |
| | | history.setTaskType(taskType); |
| | | return history; |
| | | }).collect(Collectors.toList()); |
| | | bigStorageCageHistoryTaskService.saveBatch(historyList); |
| | | |
| | | log.info("将出片玻璃{}玻璃状态改为出片中", glassIds); |
| | | bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getState, state) |
| | | .set(Const.BIG_STORAGE_BEFORE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot) |
| | | .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 1)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | // /** |
| | | // * 出片一次仅生成一车玻璃 |
| | | // * |
| | | // * @param list |
| | | // * @param <T> |
| | | // * @return |
| | | // */ |
| | | private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType) { |
| | | //任务数据:获取车子存放玻璃最大数量,玻璃间隔 |
| | | List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>(); |
| | | //打车剩余尺寸 |
| | | Integer remainWidth = carWidth; |
| | | for (T e : list) { |
| | | if (bigStorageCageTaskList.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, |
| | | 0)); |
| | | } |
| | | Assert.isFalse(CollectionUtil.isEmpty(bigStorageCageTaskList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", bigStorageCageTaskList.size()); |
| | | List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | int glassCount = bigStorageCageTaskList.size(); |
| | | //生成出片任务条数不足6补全 |
| | | while (bigStorageCageTaskList.size() < 6) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | List<BigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | BigStorageCageHistoryTask history = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(e, history); |
| | | history.setGlassCount(glassCount); |
| | | history.setTaskType(taskType); |
| | | return history; |
| | | }).collect(Collectors.toList()); |
| | | bigStorageCageHistoryTaskService.saveBatch(historyList); |
| | | |
| | | log.info("将出片玻璃{}玻璃状态改为出片中", glassIds); |
| | | bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getState, state) |
| | | .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .set(Const.GLASS_STATE_SCHEDULE_ING.equals(state), BigStorageCageBaseInfo::getSlot, targetSlot) |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 1)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | |
| | | public void updateSlotRemainBySlots(List<Integer> slotList) { |
| | | //获取格子内所有的玻璃信息 |
| | | List<BigStorageCageDetails> inSlotGlassList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .in(BigStorageCageDetails::getSlot, slotList).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | Map<Integer, Double> slotRemainMap = new HashMap<>(); |
| | | //是否存在有格子非空的玻璃 |
| | | if (CollectionUtil.isNotEmpty(inSlotGlassList)) { |
| | | //存在 将格子内的玻璃分别进行更新 |
| | | slotRemainMap = inSlotGlassList.stream() |
| | | .collect(Collectors.groupingBy(BigStorageCageDetails::getSlot, Collectors.summingDouble(item -> Math.max(item.getWidth(), item.getHeight()) + glassGap))); |
| | | slotRemainMap.forEach((e, v) -> { |
| | | double remainWidth = slotWidth - v >= 0 ? slotWidth - v : 0; |
| | | bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, remainWidth) |
| | | .eq(BigStorageCage::getSlot, e)); |
| | | }); |
| | | } |
| | | //过滤不存在玻璃的格子 将宽度重置为原始宽度5000 |
| | | Set<Integer> remainSlotList = slotRemainMap.keySet(); |
| | | slotList.removeAll(remainSlotList); |
| | | if (CollectionUtil.isNotEmpty(slotList)) { |
| | | bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, slotWidth) |
| | | .in(BigStorageCage::getSlot, slotList)); |
| | | } |
| | | } |
| | | |
| | | private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) { |
| | | return ReadWriteEntity.builder() |
| | | .identifier(identifier) |
| | | //Kep中是Long类型,即:Int32,Java中的int类型 |
| | | .value(value) |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.SlotSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlass; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassService; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Resource |
| | | private TemperingGlassService temperingGlassService; |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Resource |
| | | private DamageService damageService; |
| | | @Resource |
| | |
| | | @Value("${mes.sequence.order}") |
| | | private boolean sequenceOrder; |
| | | |
| | | @Value("${mes.temperingOutTargetPosition}") |
| | | private Integer temperingOutTargetPosition; |
| | | @Value("${mes.artificialOutTargetPosition}") |
| | | private Integer artificialOutTargetPosition; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task"); |
| | | if (CollectionUtils.isEmpty(inTaskList)) { |
| | | if (CollectionUtil.isEmpty(inTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束进片任务"); |
| | | } |
| | | |
| | | List<String> glassIdList = inTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | log.info("获取任务的玻璃id:{}", glassIdList); |
| | | Map<String, Long> glassCountMap = glassIdList.stream().collect(Collectors.groupingBy(e -> e, Collectors.counting())); |
| | | for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) { |
| | | if (entry.getValue() > 1) { |
| | | log.info("进片玻璃{}存在相同,结束本次任务", entry.getKey()); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | } |
| | | List<BigStorageCageDetails> detailsList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>().in(BigStorageCageDetails::getGlassId, glassIdList) |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | if (CollectionUtil.isNotEmpty(detailsList)) { |
| | | log.info("理片笼存在相同的进片玻璃{},结束本次任务", detailsList); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList)); |
| | | |
| | | Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId)); |
| | | |
| | | //计算目标格子 |
| | |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 1)); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void outBigStorageTask() throws Exception { |
| | | Date startDate = new Date(); |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtils.isNotEmpty(outTaskList)) { |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | | } |
| | | //todo:是否允许钢化 |
| | | if (redisUtil.getCacheObject("temperingSwitch")) { |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | List<TemperingGlass> temperingGlassList = temperingGlassService.selectJoinList(TemperingGlass.class, new MPJLambdaWrapper<TemperingGlass>() |
| | | .selectAll(TemperingGlass.class) |
| | | .leftJoin(BigStorageCageHistoryTask.class, BigStorageCageHistoryTask::getGlassId, TemperingGlass::getGlassId) |
| | | .eq(TemperingGlass::getState, Const.TEMPERING_NEW) |
| | | .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_OUT) |
| | | .isNull(BigStorageCageHistoryTask::getGlassId) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlass::getTemperingFeedSequence)); |
| | | //todo:历史任务表 |
| | | if (CollectionUtils.isNotEmpty(temperingGlassList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfo(temperingGlassList, "big_storage_cage_out_one_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW)); |
| | | if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | List<String> glassIdList = unFinishTemperingGlassInfoList.stream().map(TemperingGlassInfo::getGlassId).collect(Collectors.toList()); |
| | | List<BigStorageCageHistoryTask> historyTaskList = bigStorageCageHistoryTaskService.list(new LambdaQueryWrapper<BigStorageCageHistoryTask>() |
| | | .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_OUT) |
| | | .in(BigStorageCageHistoryTask::getGlassId, glassIdList)); |
| | | List<TemperingGlassInfo> temperingGlassList = unFinishTemperingGlassInfoList; |
| | | if (CollectionUtil.isNotEmpty(historyTaskList)) { |
| | | List<String> taskGlassList = historyTaskList.stream().map(BigStorageCageHistoryTask::getGlassId).collect(Collectors.toList()); |
| | | temperingGlassList = unFinishTemperingGlassInfoList.stream().filter(e -> !taskGlassList.contains(e.getGlassId())).collect(Collectors.toList()); |
| | | } |
| | | if (CollectionUtil.isNotEmpty(temperingGlassList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfo(temperingGlassList, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | } |
| | | //钢化优先:获取理片笼 玻璃小片 破损表 数量 判断笼内版图是否到齐 |
| | | List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll(); |
| | | if (CollectionUtils.isNotEmpty(temperingLayoutDTOList)) { |
| | | if (CollectionUtil.isNotEmpty(temperingLayoutDTOList)) { |
| | | //玻璃到齐包括已出片的 |
| | | //到齐,将玻璃小片数据存入钢化小片表,逻辑生成出片任务 结束 |
| | | for (TemperingLayoutDTO item : temperingLayoutDTOList) { |
| | | // if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) { |
| | | List<TemperingGlass> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlass.class, JoinWrappers.lambda(GlassInfo.class) |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) |
| | | .selectAll(GlassInfo.class) |
| | | .select("-1 as state") |
| | | .selectAs(BigStorageCageDetails::getSlot, TemperingGlassInfo::getSlot) |
| | |
| | | .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId()) |
| | | .eq(GlassInfo::getEngineerId, item.getEngineerId()) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassService.saveBatch(temperingGlassInfos); |
| | | computeOutGlassInfo(temperingGlassInfos, "big_storage_cage_out_one_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | if (CollectionUtil.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | | computeOutGlassInfo(temperingGlassInfos, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL) |
| | | .orderByAsc(BigStorageCageDetails::getSlot) |
| | | .orderByDesc(BigStorageCageDetails::getId)); |
| | | if (CollectionUtils.isNotEmpty(artificialList)) { |
| | | computeOutGlassInfo(artificialList, "big_storage_cage_out_one_task", Const.ARTIFICIAL_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | .orderByAsc(BigStorageCageDetails::getId)); |
| | | if (CollectionUtil.isNotEmpty(artificialList)) { |
| | | computeOutGlassInfo(artificialList, "big_storage_cage_out_one_task", artificialOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | | List<TemperingLayoutDTO> temperingOccupySlotList = bigStorageCageDetailsService.queryTemperingOccupySlot(); |
| | | if (CollectionUtils.isNotEmpty(temperingOccupySlotList)) { |
| | | if (CollectionUtil.isNotEmpty(temperingOccupySlotList)) { |
| | | loop: |
| | | for (TemperingLayoutDTO temperingOccupySlot : temperingOccupySlotList) { |
| | | List<SlotSequenceDTO> slotSequenceList = bigStorageCageDetailsService.queryGlassMaxAndMin(temperingOccupySlot.getEngineerId(), temperingOccupySlot.getTemperingLayoutId()); |
| | |
| | | int totalCount = first.getGlassCount() + second.getGlassCount(); |
| | | if (totalCount <= 6 && first.getMinSequence() == second.getMaxSequence() + 1 |
| | | && 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) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, BigStorageCageDetails::getTemperingFeedSequence)); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | computeOutGlassInfo(list, "big_storage_cage_out_one_task", second.getSlot(), Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_BEFORE_DISPATCH); |
| | | } |
| | | updateSlotRemainBySlots(Arrays.asList(second.getSlot())); |
| | | //使用Arrays.asList() 使用removeAll报错,改为正常使用List |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | slotList.add(second.getSlot()); |
| | | updateSlotRemainBySlots(slotList); |
| | | break loop; |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void finishInBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task"); |
| | | if (CollectionUtils.isEmpty(inTaskList)) { |
| | | if (CollectionUtil.isEmpty(inTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = inTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(unFinishTaskList)) { |
| | | if (CollectionUtil.isNotEmpty(unFinishTaskList)) { |
| | | log.info("存在未完成的玻璃信息,玻璃:{}", unFinishTaskList); |
| | | return; |
| | | } |
| | |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 0)); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void finishOutBigStorageTask() throws Exception { |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | // log.info("当前为非联机状态,结束完成出片任务"); |
| | | // return; |
| | | // } |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束完成出片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtils.isEmpty(outTaskList)) { |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = outTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(unFinishTaskList)) { |
| | | if (CollectionUtil.isNotEmpty(unFinishTaskList)) { |
| | | log.info("存在未完成的玻璃信息,玻璃:{}", unFinishTaskList); |
| | | return; |
| | | } |
| | |
| | | } |
| | | return storageCageDTO; |
| | | }).collect(Collectors.toList()); |
| | | bigStorageCageDetailsService.updateBySlot(storageCageDTOList, finalTaskType); |
| | | bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT); |
| | | log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", v); |
| | | updateSlotRemainBySlots(outSuccessGlassSlot); |
| | | } else if (e1 == 3) { |
| | |
| | | .set(BigStorageCageHistoryTask::getTaskState, item.getTaskState()) |
| | | .eq(BigStorageCageHistoryTask::getTaskType, taskType) |
| | | .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | //更新钢化小片表 |
| | | Integer taskState = item.getTaskState(); |
| | | if (taskState == 2) { |
| | | temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .set(TemperingGlassInfo::getState, Const.TEMPERING_OUT).eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | } else if (taskState == 3) { |
| | | // temperingGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .set(TemperingGlassInfo::getState, Const.TEMPERING_DAMAGE |
| | | ).eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | |
| | | } else { |
| | | // 空执行 |
| | | } |
| | | } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task"); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 0)); |
| | |
| | | bigStorageCageTaskList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot, |
| | | 0)); |
| | | } |
| | | Assert.isFalse(CollectionUtils.isEmpty(bigStorageCageTaskList), "未获取出片数据,结束出片任务"); |
| | | Assert.isFalse(CollectionUtil.isEmpty(bigStorageCageTaskList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", bigStorageCageTaskList.size()); |
| | | List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | int glassCount = bigStorageCageTaskList.size(); |
| | |
| | | while (bigStorageCageTaskList.size() < 6) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | List<BigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | BigStorageCageHistoryTask history = new BigStorageCageHistoryTask(); |
| | |
| | | .set(BigStorageCageDetails::getState, state) |
| | | .set(Const.GLASS_STATE_SCHEDULE_ING.equals(state), BigStorageCageBaseInfo::getSlot, targetSlot) |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 1)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | |
| | | .in(BigStorageCageDetails::getSlot, slotList).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | Map<Integer, Double> slotRemainMap = new HashMap<>(); |
| | | //是否存在有格子非空的玻璃 |
| | | if (CollectionUtils.isNotEmpty(inSlotGlassList)) { |
| | | if (CollectionUtil.isNotEmpty(inSlotGlassList)) { |
| | | //存在 将格子内的玻璃分别进行更新 |
| | | slotRemainMap = inSlotGlassList.stream() |
| | | .collect(Collectors.groupingBy(BigStorageCageDetails::getSlot, Collectors.summingDouble(item -> Math.max(item.getWidth(), item.getHeight()) + glassGap))); |
| | |
| | | //过滤不存在玻璃的格子 将宽度重置为原始宽度5000 |
| | | Set<Integer> remainSlotList = slotRemainMap.keySet(); |
| | | slotList.removeAll(remainSlotList); |
| | | if (CollectionUtils.isNotEmpty(slotList)) { |
| | | if (CollectionUtil.isNotEmpty(slotList)) { |
| | | bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, slotWidth) |
| | | .in(BigStorageCage::getSlot, slotList)); |
| | | } |
| | |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.SlotSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private String d01GlassId = ""; |
| | | private String d04GlassId = ""; |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void plcToHomeEdgScan() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼扫码任务开始执行时间:{}", startDate); |
| | |
| | | } |
| | | //按照线路及玻璃id获取相邻两块玻璃 卧转立上的玻璃: 状态为0不操作(D01送片,0不操作,1允许送片),请求字为1, (02玻璃id为空或者卧转立未启动) |
| | | if (!REQUEST_WORD.equals(mesD01Value) && REQUEST_WORD.equals(d01ToMES) && (StringUtils.isBlank(d02State) || !REQUEST_WORD.equals(d03State))) { |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTasks=bigStorageCageFeedTaskService.list( |
| | | new LambdaQueryWrapper<BigStorageCageFeedTask>() |
| | | .gt(BigStorageCageFeedTask::getTargetSlot,0) |
| | | .eq(BigStorageCageFeedTask::getLine,Const.A09_OUT_TARGET_POSITION) |
| | | .eq(BigStorageCageFeedTask::getTaskState,Const.BIG_STORAGE_IN_UP) |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTasks = bigStorageCageFeedTaskService.list( |
| | | new LambdaQueryWrapper<BigStorageCageFeedTask>() |
| | | .gt(BigStorageCageFeedTask::getTargetSlot, 0) |
| | | .eq(BigStorageCageFeedTask::getLine, Const.A09_OUT_TARGET_POSITION) |
| | | .eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_UP) |
| | | ); |
| | | if(CollectionUtils.isEmpty(bigStorageCageFeedTasks)){ |
| | | if (CollectionUtils.isEmpty(bigStorageCageFeedTasks)) { |
| | | if (!d01GlassId.equals(d01Id)) { |
| | | judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD01Address); |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getStatus, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d01Id)); |
| | | .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d01Id)); |
| | | // d01GlassId = d01Id; |
| | | } |
| | | } |
| | | } |
| | | // 状态为0不操作(D01送片,0不操作,1允许送片),请求字为1, 卧转立未启动 |
| | | if (!REQUEST_WORD.equals(mesD04Value) && REQUEST_WORD.equals(d04ToMES) && !REQUEST_WORD.equals(d05State)) { |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTasks=bigStorageCageFeedTaskService.list( |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTasks = bigStorageCageFeedTaskService.list( |
| | | new LambdaQueryWrapper<BigStorageCageFeedTask>() |
| | | .gt(BigStorageCageFeedTask::getTargetSlot,0) |
| | | .eq(BigStorageCageFeedTask::getLine,Const.A10_OUT_TARGET_POSITION) |
| | | .eq(BigStorageCageFeedTask::getTaskState,Const.BIG_STORAGE_IN_UP) |
| | | .gt(BigStorageCageFeedTask::getTargetSlot, 0) |
| | | .eq(BigStorageCageFeedTask::getLine, Const.A10_OUT_TARGET_POSITION) |
| | | .eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_UP) |
| | | ); |
| | | if(CollectionUtils.isEmpty(bigStorageCageFeedTasks)){ |
| | | if (CollectionUtils.isEmpty(bigStorageCageFeedTasks)) { |
| | | if (!d04GlassId.equals(d04Id)) { |
| | | judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION, mesD04Address); |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getStatus, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d04Id)); |
| | | .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d04Id)); |
| | | // d04GlassId = d04Id; |
| | | } |
| | | } |
| | |
| | | log.info("大理片笼扫码任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void plcToHomeEdgFreeCarTask() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼空车进片任务开始执行时间:{}", startDate); |
| | |
| | | //获取卧转立剩余宽度 |
| | | if (computeIsRun(lineFirst, lineGlassId)) { |
| | | computeTargetByLine(lineFirst); |
| | | }else{ |
| | | log.info("当前线路:{},有扫码玻璃:{}",lineFirst,lineGlassId); |
| | | } else { |
| | | log.info("当前线路:{},有扫码玻璃:{}", lineFirst, lineGlassId); |
| | | } |
| | | } |
| | | Date endDate = new Date(); |
| | |
| | | log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 10000) |
| | | // @Scheduled(fixedDelay = 10000) |
| | | public void plcToHomeEdgOutTask() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼空车进片任务开始执行时间:{}", startDate); |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void updateInGlassStateTask() { |
| | | Date startDate = new Date(); |
| | | log.info("1、大理片笼进片完成后更新大理片笼数据任务开始执行时间:{}", startDate); |
| | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void updateOutGlassStateTask() { |
| | | Date startDate = new Date(); |
| | | log.info("1、大理片笼出片完成后更新大理片笼数据任务开始执行时间:{}", startDate); |
| | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void updateScheduleGlassStateTask() { |
| | | Date startDate = new Date(); |
| | | log.info("1、大理片笼调度完成后更新大理片笼数据任务开始执行时间:{}", startDate); |
| | |
| | | /** |
| | | * 处理破损表任务 |
| | | */ |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼破损玻璃清除任务开始执行时间:{}", startDate); |
| | |
| | | /** |
| | | * 确认字清空 |
| | | */ |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void confirmClear() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String d01ToMES = plcParameterObject.getPlcParameter("D01ToMES").getValue(); |
| | |
| | | String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress(); |
| | | String mesD05Address = plcParameterObject.getPlcParameter("MESToD05").getAddress(); |
| | | if (!REQUEST_WORD.equals(d01ToMES)) { |
| | | log.info("地址:{}写入0",mesD01Address); |
| | | log.info("地址:{}写入0", mesD01Address); |
| | | S7object.getinstance().plccontrol.writeWord(mesD01Address, 0); |
| | | } |
| | | if (!REQUEST_WORD.equals(d04ToMES)) { |
| | | log.info("地址:{}写入0",mesD04Address); |
| | | log.info("地址:{}写入0", mesD04Address); |
| | | S7object.getinstance().plccontrol.writeWord(mesD04Address, 0); |
| | | } |
| | | if (!REQUEST_WORD.equals(d03ToMES)) { |
| | | log.info("地址:{}写入0",mesD03Address); |
| | | log.info("地址:{}写入0", mesD03Address); |
| | | S7object.getinstance().plccontrol.writeWord(mesD03Address, 0); |
| | | } |
| | | if (!REQUEST_WORD.equals(d05ToMES)) { |
| | | log.info("地址:{}写入0",mesD05Address); |
| | | log.info("地址:{}写入0", mesD05Address); |
| | | S7object.getinstance().plccontrol.writeWord(mesD05Address, 0); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 进片状态修改 |
| | | */ |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void feedStatusUpdate() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress(); |
| | |
| | | .filter(glassIds1::contains) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | log.info("D3id{},匹配id:{}",glassIds1,matchingIds1); |
| | | if(CollectionUtils.isNotEmpty(matchingIds1)){ |
| | | log.info("D3id{},匹配id:{}", glassIds1, matchingIds1); |
| | | if (CollectionUtils.isNotEmpty(matchingIds1)) { |
| | | bigStorageCageFeedTaskService.update( |
| | | new LambdaUpdateWrapper<BigStorageCageFeedTask>() |
| | | .in(BigStorageCageFeedTask::getGlassId, matchingIds1) |
| | |
| | | .filter(glassIds2::contains) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | log.info("D5id{},匹配id:{}",glassIds2,matchingIds2); |
| | | if(CollectionUtils.isNotEmpty(matchingIds2)){ |
| | | log.info("D5id{},匹配id:{}", glassIds2, matchingIds2); |
| | | if (CollectionUtils.isNotEmpty(matchingIds2)) { |
| | | bigStorageCageFeedTaskService.update( |
| | | new LambdaUpdateWrapper<BigStorageCageFeedTask>() |
| | | .in(BigStorageCageFeedTask::getGlassId, matchingIds2) |
| | |
| | | } |
| | | if (CollectionUtils.isEmpty(glassIds1)) { |
| | | S7object.getinstance().plccontrol.writeWord(mesD03Address, 0); |
| | | log.info("{}线修改玻璃状态为3",Const.A09_OUT_TARGET_POSITION); |
| | | log.info("{}线修改玻璃状态为3", Const.A09_OUT_TARGET_POSITION); |
| | | bigStorageCageFeedTaskService.update( |
| | | new LambdaUpdateWrapper<BigStorageCageFeedTask>() |
| | | .eq(BigStorageCageFeedTask::getLine, Const.A09_OUT_TARGET_POSITION) |
| | |
| | | } |
| | | if (CollectionUtils.isEmpty(glassIds2)) { |
| | | S7object.getinstance().plccontrol.writeWord(mesD05Address, 0); |
| | | log.info("{}线修改玻璃状态为3",Const.A10_OUT_TARGET_POSITION); |
| | | log.info("{}线修改玻璃状态为3", Const.A10_OUT_TARGET_POSITION); |
| | | bigStorageCageFeedTaskService.update( |
| | | new LambdaUpdateWrapper<BigStorageCageFeedTask>() |
| | | .eq(BigStorageCageFeedTask::getLine, Const.A10_OUT_TARGET_POSITION) |
| | |
| | | edgGlassTaskInfoList = edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | .eq(EdgGlassTaskInfo::getLine, line) |
| | | .apply("time >= (select time from edg_glass_task_info where line='" + line + "' and glass_id = '" + glassId + "' and deleted = 0)") |
| | | .orderByAsc(EdgGlassTaskInfo::getTime)); |
| | | .orderByAsc(EdgGlassTaskInfo::getCreateTime)); |
| | | if (edgGlassTaskInfoList.size() == 0) { |
| | | edgGlassTaskInfoList = edgGlassTaskInfoService.list(new QueryWrapper<EdgGlassTaskInfo>() |
| | | .select("Top 1 *") |
| | |
| | | returnData = glassIds2; |
| | | } |
| | | // returnData = s7control.readWord(outLine, 1).get(0); |
| | | log.info("已向plc第{}次发送进片任务确认,地址为:{},写入的内容为{},读到的请求为{}", count++, outLine, 2,returnData); |
| | | log.info("已向plc第{}次发送进片任务确认,地址为:{},写入的内容为{},读到的请求为{}", count++, outLine, 2, returnData); |
| | | } |
| | | // while (returnData != 0) { |
| | | // s7control.writeWord(outLine, 2); |
| | |
| | | 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, new Date())); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | // maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | break; |
| | | } |
| | |
| | | if (maxX + minLength <= xMaxSize) { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight() * 10, trainNumber, serialNumber++, 1, new Date())); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | // maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | remainWidth = carWidth - maxLength - glassGap; |
| | | trainNumber = trainNumber + 1; |
| | | serialNumber = 1; |
| | | maxX = e.getXCoordinate(); |
| | | // maxX = e.getXCoordinate(); |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight(), trainNumber, serialNumber++, 1, new Date())); |
| | | } |
| | |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.SlotSequenceDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 10000) |
| | | // @Scheduled(fixedDelay = 10000) |
| | | public void plcToHomeEdgOutTask() { |
| | | String mesToPLCAddress = ""; |
| | | List<BigStorageCageOutTask> outingList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>() |
| | |
| | | /** |
| | | * 确认字清空 |
| | | */ |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void confirmClear() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String d01ToMES = plcParameterObject.getPlcParameter("D01ToMES").getValue(); |
| | |
| | | /** |
| | | * 进片状态修改 |
| | | */ |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void feedStatusUpdate() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | List<String> glassIds1 = new ArrayList<>(); |
| | |
| | | edgGlassTaskInfoList = edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | .eq(EdgGlassTaskInfo::getLine, line) |
| | | .apply("time >= (select time from edg_glass_task_info where line='" + line + "' and glass_id = '" + glassId + "' and deleted = 0)") |
| | | .orderByAsc(EdgGlassTaskInfo::getTime)); |
| | | .orderByAsc(EdgGlassTaskInfo::getCreateTime)); |
| | | if (edgGlassTaskInfoList.size() == 0) { |
| | | edgGlassTaskInfoList = edgGlassTaskInfoService.list(new QueryWrapper<EdgGlassTaskInfo>() |
| | | .select("Top 1 *") |
| | |
| | | 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, new Date())); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | // maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | break; |
| | | } |
| | |
| | | if (maxX + minLength <= xMaxSize) { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight() * 10, trainNumber, serialNumber++, 1, new Date())); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | // maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | remainWidth = carWidth - maxLength - glassGap; |
| | | trainNumber = trainNumber + 1; |
| | | serialNumber = 1; |
| | | maxX = e.getXCoordinate(); |
| | | // maxX = e.getXCoordinate(); |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight(), trainNumber, serialNumber++, 1, new Date())); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void querySizeByEngineerTask() { |
| | | log.info("查询结果:{}", querySizeByEngineer("P24072402", 1, 10, 8)); |
| | | log.info("查询结果:{}", querySizeByEngineer("P24072402", 1, 5, 8)); |
| | |
| | | |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + engineerId + "' and tempering_layout_id = " + temperingLayoutId) |
| | | .last("limit 1")); |
| | |
| | | List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(thickness); |
| | | for (Integer item : deviceUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| | |
| | | package com.mes.tools.service; |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | |
| | | import com.mes.tools.service.BigStorageBaseService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void querySizeByEngineerTask() { |
| | | log.info("查询结果:{}", querySizeByEngineer("P24072402", 1, 10, 8)); |
| | | log.info("查询结果:{}", querySizeByEngineer("P24072402", 1, 5, 8)); |
| | |
| | | |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + engineerId + "' and tempering_layout_id = " + temperingLayoutId) |
| | | .last("limit 1")); |
| | |
| | | List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(thickness); |
| | | for (Integer item : deviceUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://192.168.2.100:1433;databasename=mes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | |
| | | spring: |
| | | profiles: |
| | | active: cz |
| | | active: yw |
| | | application: |
| | | name: cacheVerticalGlass |
| | | liquibase: |
| | |
| | | thread-name-prefix: task-cacheVertical |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | # configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | mes: |
| | | sequence: |
| | | order: false |
| | | minCount: 20 |
| | | carWidth: 5000 #大车宽度 |
| | | slotWidth: 5500 #大车宽度 |
| | | inCarMaxSize: 2 #进片大车最大存放玻璃数量 |
| | | outCarMaxSize: 3 #出片大车最大存放玻璃数量 |
| | | glassGap: 350 #玻璃间距 |
| | | order: true |
| | | minCount: 30 |
| | | carWidth: 6200 #大车宽度 |
| | | slotWidth: 6200 #大车宽度 |
| | | inCarMaxSize: 5 #进片大车最大存放玻璃数量 |
| | | outCarMaxSize: 6 #出片大车最大存放玻璃数量 |
| | | glassGap: 250 #玻璃间距 |
| | | xMaxSize: 2800 |
| | | temperingOutTargetPosition: 930 |
| | | artificialOutTargetPosition: 931 |
| | | |
| | | scan: |
| | | ip: 192.168.30.199 |
| | | port: 5000 |
| | | kangaroohy: |
| | | milo: |
| | | enabled: false |
| | | enabled: true |
| | | primary: default |
| | | config: |
| | | default: |
| | | endpoint: opc.tcp://192.168.2.100:49320 |
| | | security-policy: basic256sha256 |
| | | username: admin |
| | | password: 1qaz2wsx3edc4rfv |
| | |
| | | <result column="remain_width" property="remainWidth"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="virtualSlotSequenceDTO" type="com.mes.bigstorage.entity.dto.BigStorageRelationDTO"> |
| | | <result column="engineer_id" property="engineerId"/> |
| | | <result column="tempering_layout_id" property="temperingLayoutId"/> |
| | | <result column="virtual_slot" property="virtualSlot"/> |
| | | </resultMap> |
| | | <resultMap id="baseSlotSequenceDTO" type="com.mes.bigstorage.entity.dto.BigStorageSequenceDTO"> |
| | | <result column="slot" property="slot"/> |
| | | <result column="max_sequence" property="maxSequence"/> |
| | | <result column="min_sequence" property="minSequence"/> |
| | | </resultMap> |
| | | |
| | | <select id="temperingIsAll" resultMap="temperingLayoutDTO"> |
| | | SELECT T2.* |
| | | FROM ( |
| | | SELECT T.ENGINEER_ID, |
| | | T.TEMPERING_LAYOUT_ID, |
| | | COUNT(T.TEMPERING_FEED_SEQUENCE) AS COUNT |
| | | FROM |
| | | GLASS_INFO T |
| | | LEFT JOIN DAMAGE T1 |
| | | ON T.ENGINEER_ID = T1.ENGINEER_ID |
| | | AND T.GLASS_ID = T1.GLASS_ID |
| | | AND (T1.TYPE = 8 |
| | | OR T1.TYPE = 9 ) |
| | | WHERE |
| | | T1.GLASS_ID IS NULL |
| | | GROUP BY |
| | | T.ENGINEER_ID, |
| | | T.TEMPERING_LAYOUT_ID |
| | | FROM GLASS_INFO T |
| | | LEFT JOIN DAMAGE T1 |
| | | ON T.ENGINEER_ID = T1.ENGINEER_ID |
| | | AND T.GLASS_ID = T1.GLASS_ID |
| | | AND (T1.TYPE = 8 |
| | | OR T1.TYPE = 9) |
| | | WHERE T1.GLASS_ID IS NULL |
| | | GROUP BY T.ENGINEER_ID, |
| | | T.TEMPERING_LAYOUT_ID |
| | | ) T2 |
| | | INNER JOIN (SELECT ENGINEER_ID, TEMPERING_LAYOUT_ID, COUNT(TEMPERING_FEED_SEQUENCE) AS COUNT |
| | | FROM BIG_STORAGE_CAGE_DETAILS |
| | |
| | | GROUP BY ENGINEER_ID, TEMPERING_LAYOUT_ID) T3 ON T2.ENGINEER_ID = T3.ENGINEER_ID |
| | | AND T2.TEMPERING_LAYOUT_ID = T3.TEMPERING_LAYOUT_ID |
| | | AND T2.COUNT = T3.COUNT |
| | | INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID=T4.ENGINEER_ID |
| | | INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID = T4.ENGINEER_ID |
| | | ORDER BY T4.ID, T2.TEMPERING_LAYOUT_ID |
| | | </select> |
| | | |
| | |
| | | (#{item.glassId}, #{item.targetSlot}) |
| | | </foreach> |
| | | ) |
| | | and state !=101 |
| | | </where> |
| | | </update> |
| | | |
| | | <select id="selectTemperingGlassCount" resultType="java.util.Map"> |
| | | select a.engineer_id,a.tempering_layout_id,count2,count1,count2-count1 as count3,count(c.glass_id) as count4 from |
| | | (select engineer_id,tempering_layout_id,count(*) as count1 from big_storage_cage_details where state=100 group by engineer_id,tempering_layout_id) as a |
| | | left join |
| | | (select engineer_id,tempering_layout_id,count(*) as count2 from glass_info group by engineer_id,tempering_layout_id) as b |
| | | on a.engineer_id=b.engineer_id and a.tempering_layout_id=b.tempering_layout_id |
| | | left join damage as c on a.engineer_id=c.engineer_id and a.tempering_layout_id=c.tempering_layout_id and (type = 8 or type = 9) |
| | | group by a.engineer_id,a.tempering_layout_id |
| | | order by a.engineer_id,a.tempering_layout_id |
| | | select a.engineer_id, |
| | | a.tempering_layout_id, |
| | | count2, |
| | | count1, |
| | | count2 - count1 as count3, |
| | | count(c.glass_id) as count4 |
| | | from (select engineer_id, tempering_layout_id, count(*) as count1 |
| | | from big_storage_cage_details |
| | | where state = 100 |
| | | group by engineer_id, tempering_layout_id) as a |
| | | left join |
| | | (select engineer_id, tempering_layout_id, count(*) as count2 |
| | | from glass_info |
| | | group by engineer_id, tempering_layout_id) as b |
| | | on a.engineer_id = b.engineer_id and a.tempering_layout_id = b.tempering_layout_id |
| | | left join damage as c |
| | | on a.engineer_id = c.engineer_id and a.tempering_layout_id = c.tempering_layout_id and |
| | | (type = 8 or type = 9) |
| | | group by a.engineer_id, a.tempering_layout_id |
| | | order by a.engineer_id, a.tempering_layout_id |
| | | </select> |
| | | |
| | | <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO"> |
| | | with relation_temp as ( |
| | | select engineer_id, tempering_layout_id, virtual_slot, count(1) as slot_count |
| | | from big_storage_glass_relation_info |
| | | group by engineer_id, tempering_layout_id, virtual_slot |
| | | ), |
| | | details_temp as ( |
| | | select t.engineer_id, t.tempering_layout_id, t.virtual_slot, count(1) as slot_count |
| | | from big_storage_glass_relation_info t |
| | | left join big_storage_cage_details t1 on |
| | | t.engineer_id = t1.engineer_id and t.tempering_layout_id = t1.tempering_layout_id and |
| | | t.tempering_feed_sequence = t1.tempering_feed_sequence |
| | | where t1.state = 100 |
| | | group by t.engineer_id, t.tempering_layout_id, t.virtual_slot |
| | | ), |
| | | result_one as ( |
| | | select t.*, t1.slot_count as tslot_count |
| | | from relation_temp t |
| | | INNER JOIN details_temp t1 on t.engineer_id = t1.engineer_id and |
| | | t.tempering_layout_id = t1.tempering_layout_id and |
| | | t.virtual_slot = t1.virtual_slot |
| | | where t.slot_count = t1.slot_count |
| | | ) |
| | | select engineer_id, tempering_layout_id, virtual_slot |
| | | from result_one |
| | | order by engineer_id, tempering_layout_id |
| | | </select> |
| | | |
| | | <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO"> |
| | | with glass_id_temp as ( |
| | | select engineer_id, tempering_layout_id, tempering_feed_sequence |
| | | from big_storage_glass_relation_info |
| | | where (engineer_id, tempering_layout_id, virtual_slot) = |
| | | (#{engineerId}, #{temperingLayoutId}, #{virtualSlot}) |
| | | ) |
| | | select t.slot, max(t1.tempering_feed_sequence) as max_sequence, min(t1.tempering_feed_sequence) as min_sequence |
| | | from big_storage_cage_details t |
| | | inner join big_storage_glass_relation_info t1 |
| | | on t.engineer_id = t1.engineer_id and t.tempering_layout_id = t1.tempering_layout_id and |
| | | t.tempering_feed_sequence = t1.tempering_feed_sequence |
| | | where (t.engineer_id, t.tempering_layout_id, t.tempering_feed_sequence) in |
| | | (select engineer_id, tempering_layout_id, tempering_feed_sequence from glass_id_temp) |
| | | and t.state = 100 |
| | | group by t.slot |
| | | order by max_sequence |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper"> |
| | | |
| | | <resultMap id="bigStorageDTO" type="com.mes.bigstorage.entity.BigStorageDTO"> |
| | | <resultMap id="bigStorageDTO" type="com.mes.bigstorage.entity.dto.BigStorageDTO"> |
| | | <result column="REMAIN_WIDTH" property="width"/> |
| | | <result column="GLASS_COUNT" property="glassCount"/> |
| | | </resultMap> |
| New file |
| | |
| | | <?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.bigstorage.mapper.BigStorageGlassRelationInfoMapper"> |
| | | |
| | | <select id="queryNeedOutGlassId" resultType="java.lang.String"> |
| | | select glass_id |
| | | from glass_info |
| | | where (engineer_id, tempering_layout_id, tempering_feed_sequence) in ( |
| | | SELECT engineer_id, tempering_layout_id, tempering_feed_sequence |
| | | FROM big_storage_glass_relation_info |
| | | WHERE (engineer_id, tempering_layout_id, virtual_slot) = |
| | | (SELECT engineer_id, tempering_layout_id, virtual_slot |
| | | FROM big_storage_glass_relation_info |
| | | WHERE engineer_id = #{engineerId} |
| | | and tempering_layout_id = #{temperingLayoutId} |
| | | and tempering_feed_sequence = #{temperingFeedSequence} |
| | | ) |
| | | ) |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8&allowMultiQueries=true |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://192.168.2.100:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | druid: |
| | | wall: |
| | | multi-statement-allow: true |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.mapper.EngineeringMapper; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Engineering> setRawGlassTaskRequest(Engineering request) { |
| | | return null; |
| | | } |
| | | |
| | | public Object Engineering(Engineering request) { |
| | | return null; |
| | | } |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8&allowMultiQueries=true |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://192.168.2.100:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | wall: |
| | | multi-statement-allow: true |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://192.168.2.100:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | application: |
| | | name: temperingGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | start_slot int DEFAULT '0' COMMENT '起始格子', |
| | | target_slot int DEFAULT '0' COMMENT '目标格子', |
| | | task_state int DEFAULT NULL COMMENT '任务状态 ' |
| | | ) |
| | | ); |
| | | -- rollback DROP TABLE big_storage_cage_in_one_task; |
| | | |
| | | -- changeset zsh:20241112003 |
| | |
| | | start_slot int DEFAULT '0' COMMENT '起始格子', |
| | | target_slot int DEFAULT '0' COMMENT '目标格子', |
| | | task_state int DEFAULT NULL COMMENT '任务状态 ' |
| | | ) |
| | | ); |
| | | -- rollback DROP TABLE big_storage_cage_out_one_task; |
| | | |
| | | -- changeset zsh:20241113002 |
| | |
| | | INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state) |
| | | VALUES (NULL, 0, 0, 0); |
| | | |
| | | |
| | | -- changeset zsh:20241126001 |
| | | -- preconditions onFail:CONTINUE onError:CONTINUE |
| | | -- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_glass_info' and table_schema = 'hangzhoumes'; |
| | | CREATE TABLE big_storage_glass_info |
| | | ( |
| | | id bigint NOT NULL AUTO_INCREMENT COMMENT '大理片笼信息表id', |
| | | glass_id varchar(20) DEFAULT NULL COMMENT '玻璃id', |
| | | flow_card_id varchar(20) DEFAULT NULL COMMENT '流程卡号', |
| | | glass_type int DEFAULT NULL COMMENT '玻璃类型', |
| | | width double DEFAULT NULL COMMENT '宽', |
| | | height double DEFAULT NULL COMMENT '高', |
| | | thickness double DEFAULT NULL COMMENT '厚度', |
| | | tempering_layout_id int DEFAULT NULL COMMENT '钢化版图id', |
| | | tempering_feed_sequence int DEFAULT NULL COMMENT '钢化版图片序', |
| | | x_coordinate int DEFAULT NULL COMMENT 'x坐标', |
| | | y_coordinate int DEFAULT NULL COMMENT 'y坐标', |
| | | engineer_id varchar(50) DEFAULT NULL, |
| | | layer int DEFAULT NULL COMMENT '层号', |
| | | virtual_slot int DEFAULT NULL COMMENT '虚拟格子号', |
| | | slot_sequence int DEFAULT NULL COMMENT '格子次序', |
| | | PRIMARY KEY (id) USING BTREE |
| | | ); |
| | | -- rollback DROP TABLE big_storage_glass_info; |
| | | |
| | | -- changeset zsh:20241126002 |
| | | -- preconditions onFail:CONTINUE onError:CONTINUE |
| | | -- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_glass_relation_info' and table_schema = 'hangzhoumes'; |
| | | CREATE TABLE big_storage_glass_relation_info |
| | | ( |
| | | id bigint NOT NULL AUTO_INCREMENT COMMENT '钢化玻璃关系表id', |
| | | engineer_id varchar(50) DEFAULT NULL, |
| | | glass_id varchar(20) DEFAULT NULL COMMENT '玻璃id', |
| | | tempering_layout_id int DEFAULT NULL COMMENT '钢化版图id', |
| | | tempering_feed_sequence int DEFAULT NULL COMMENT '钢化版图片序', |
| | | virtual_slot int DEFAULT NULL COMMENT '虚拟格子', |
| | | slot_sequence int DEFAULT NULL COMMENT '格子内次序', |
| | | slot int DEFAULT NULL COMMENT '实际格子号', |
| | | device_id int DEFAULT NULL COMMENT '实际笼子号', |
| | | PRIMARY KEY (id) USING BTREE |
| | | ); |
| | | -- rollback DROP TABLE big_storage_glass_relation_info; |
| | | |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>howllowGlass</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
| New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/28 14:21 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2WebMvc |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | @EnableScheduling |
| | | public class HollowGlassApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(HollowGlassApplication.class, args); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * (HollowBigStorageCage)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:22:39 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("hollowBigStorageCage") |
| | | public class HollowBigStorageCageController { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageDetails)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:23:12 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("hollowBigStorageCageDetails") |
| | | public class HollowBigStorageCageDetailsController { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.controller; |
| | | |
| | | |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * (HollowGlassOutRelationInfo)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 13:57:28 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("hollowGlassOutRelationInfo") |
| | | public class HollowGlassOutRelationInfoController { |
| | | |
| | | @Resource |
| | | HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService; |
| | | |
| | | @ApiOperation("领取任务") |
| | | @PostMapping("/receiveTask") |
| | | public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell, int totalPairQuantity) { |
| | | return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity)); |
| | | } |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.controller; |
| | | |
| | | |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import com.mes.hollow.service.HollowGlassRelationInfoService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * (HollowGlassRelationInfo)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-23 15:59:27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("hollowGlassRelationInfo") |
| | | public class HollowGlassRelationInfoController { |
| | | |
| | | @Resource |
| | | HollowGlassRelationInfoService hollowGlassRelationInfoService; |
| | | |
| | | @ApiOperation("界面点击创建任务:查询中空所有流程卡对应的玻璃信息") |
| | | @PostMapping("/queryHollowAllFlowCard") |
| | | public Result<Map<String, List<FlowCardGlassInfoDTO>>> queryHollowAllFlowCard() { |
| | | Map<String, List<FlowCardGlassInfoDTO>> bigStorageCageDetails = hollowGlassRelationInfoService.queryHollowAllFlowCard(); |
| | | return Result.success(bigStorageCageDetails); |
| | | } |
| | | |
| | | @ApiOperation("查询指定流程卡及层数的缺片详情") |
| | | @PostMapping("/queryLackByFlowCard") |
| | | public Result<List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId, int layer) { |
| | | List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId, layer); |
| | | return Result.success(lackDetailsList); |
| | | } |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * (HollowBigStorageCage)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:22:45 |
| | | */ |
| | | @Data |
| | | public class HollowBigStorageCage { |
| | | /** |
| | | * /*大理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * /*设备id |
| | | */ |
| | | private Integer deviceId; |
| | | /** |
| | | * /*栅格号 |
| | | */ |
| | | private Integer slot; |
| | | /** |
| | | * /*最小厚度 |
| | | */ |
| | | private Integer minThickness; |
| | | /** |
| | | * /*最大厚度 |
| | | */ |
| | | private Integer maxThickness; |
| | | /** |
| | | * /*启用状态 |
| | | */ |
| | | private Integer enableState; |
| | | /** |
| | | * /*剩余宽度 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.mes.base.entity.HollowBigStorageCageBaseInfo; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageDetails)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:23:12 |
| | | */ |
| | | @Data |
| | | public class HollowBigStorageCageDetails extends HollowBigStorageCageBaseInfo { |
| | | /** |
| | | * /*大理片笼详情表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | /** |
| | | * /*虚拟格子 |
| | | */ |
| | | private Integer virtualSlot; |
| | | /** |
| | | * /*小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | /** |
| | | * /*流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * /*玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | | /** |
| | | * /*厚度 |
| | | */ |
| | | private Double thickness; |
| | | /** |
| | | * /*状态 |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * /*玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | private String engineerId; |
| | | /** |
| | | * /*层号 |
| | | */ |
| | | private Integer totalLayer; |
| | | |
| | | /** |
| | | * /*层号 |
| | | */ |
| | | private Integer hollowSequence; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * (HollowGlassOutRelationInfo)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 13:57:29 |
| | | */ |
| | | @Data |
| | | public class HollowGlassOutRelationInfo { |
| | | /** |
| | | * /*中空玻璃关系表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * /*流程卡 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * /*总层数 |
| | | */ |
| | | private Integer totalLayer; |
| | | /** |
| | | * /*路线 |
| | | */ |
| | | private Integer cell; |
| | | /** |
| | | * /*状态0新增 1执行中 2暂停 3结束 |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 总配对数量 |
| | | */ |
| | | private Integer totalPairQuantity; |
| | | /** |
| | | * 已完成配对数量 |
| | | */ |
| | | private Integer pairQuantity; |
| | | /** |
| | | * /*创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * /*更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * (HollowGlassRelationInfo)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-23 15:59:29 |
| | | */ |
| | | @Data |
| | | public class HollowGlassRelationInfo { |
| | | /** |
| | | * /*中空玻璃关系表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * /*玻璃ID |
| | | */ |
| | | private String glassId; |
| | | /** |
| | | * /*流程卡 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | | |
| | | /** |
| | | * 宽度 |
| | | */ |
| | | private double width; |
| | | |
| | | /** |
| | | * 高度 |
| | | */ |
| | | private double height; |
| | | |
| | | /** |
| | | * /*厚度 |
| | | */ |
| | | private Double thickness; |
| | | /** |
| | | * /*总层数 |
| | | */ |
| | | private Integer totalLayer; |
| | | /** |
| | | * /*层数 |
| | | */ |
| | | private Integer layer; |
| | | /** |
| | | * /*虚拟格子号 |
| | | */ |
| | | private Integer virtualSlot; |
| | | /** |
| | | * /*中空格子次序 |
| | | */ |
| | | private Integer slotSequence; |
| | | /** |
| | | * /*中空总次序 |
| | | */ |
| | | private Integer hollowSequence; |
| | | /** |
| | | * /*中空总次序 |
| | | */ |
| | | private Integer orderSort; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/25 18:53 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class BigStorageSequenceDTO { |
| | | |
| | | private Integer slot; |
| | | private Integer maxSequence; |
| | | private Integer minSequence; |
| | | |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/30 13:34 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class FlowCardGlassInfoDTO { |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String engineerId; |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | | /** |
| | | * 层号 |
| | | */ |
| | | private int layer; |
| | | /** |
| | | * 层号 |
| | | */ |
| | | private int sumCount; |
| | | /** |
| | | * 配对数量 |
| | | */ |
| | | private int pairCount; |
| | | /** |
| | | * 实际数量 |
| | | */ |
| | | private int realCount; |
| | | /** |
| | | * 破损数量 |
| | | */ |
| | | private int damageCount; |
| | | /** |
| | | * 缺少数量 |
| | | */ |
| | | private int lackCount; |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/30 16:10 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class FlowCardVirtualSlotDTO { |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * 层号 |
| | | */ |
| | | private Integer layer; |
| | | /** |
| | | * /*虚拟格子 |
| | | */ |
| | | private Integer virtualSlot; |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/27 11:36 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class HollowBigStorageDTO extends HollowGlassRelationInfo { |
| | | /** |
| | | * 格子号 |
| | | */ |
| | | private Integer slot; |
| | | /** |
| | | * 剩余宽度 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | /** |
| | | * 玻璃数量 |
| | | */ |
| | | private Integer glassCount; |
| | | |
| | | /** |
| | | * 笼子号 |
| | | */ |
| | | private Integer deviceId; |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/28 23:35 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class HollowGlassDetailsDTO { |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private Integer orderSort; |
| | | /** |
| | | * 宽度 |
| | | */ |
| | | private double width; |
| | | |
| | | /** |
| | | * 高度 |
| | | */ |
| | | private double height; |
| | | |
| | | /** |
| | | * /*厚度 |
| | | */ |
| | | private double thickness; |
| | | /** |
| | | * /*层数 |
| | | */ |
| | | private Integer layer; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer quantity; |
| | | |
| | | /** |
| | | * /*中空总次序 |
| | | */ |
| | | private Integer hollowSequence; |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/11/25 18:53 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class LackDetailsDTO { |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private int layer; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | | /** |
| | | * 宽度 |
| | | */ |
| | | private double width; |
| | | |
| | | /** |
| | | * 高度 |
| | | */ |
| | | private double height; |
| | | |
| | | /** |
| | | * /*厚度 |
| | | */ |
| | | private Double thickness; |
| | | /** |
| | | * /*总片数 |
| | | */ |
| | | private Integer totalCount; |
| | | /** |
| | | * /*缺少片数 |
| | | */ |
| | | private Integer lackCount; |
| | | /** |
| | | * /*破损片数 |
| | | */ |
| | | private Integer damageCount; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/7/26 9:05 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class UpdateHollowBigStorageCageDTO { |
| | | |
| | | private String glassId; |
| | | |
| | | private int targetSlot; |
| | | } |
| New file |
| | |
| | | package com.mes.hollow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO; |
| | | import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageDetails)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:23:12 |
| | | */ |
| | | public interface HollowBigStorageCageDetailsMapper extends BaseMapper<HollowBigStorageCageDetails> { |
| | | |
| | | void updateBySlot(@Param("list") List<UpdateHollowBigStorageCageDTO> storageCageDTOList, @Param("state") Integer state); |
| | | |
| | | List<FlowCardGlassInfoDTO> hollowIsAll(@Param("flowCardId") String flowCardId, @Param("totalLayer") int totalLayer, @Param("flag") Boolean flag); |
| | | |
| | | List<FlowCardVirtualSlotDTO> queryIsAllNeedDispatchVirtualSlot(); |
| | | |
| | | List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO); |
| | | |
| | | List<HollowBigStorageCageDetails> queryOutGlassList(@Param("flowCardId") String flowCardId, @Param("cell") int cell); |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollow.entity.HollowBigStorageCage; |
| | | |
| | | /** |
| | | * (HollowBigStorageCage)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:22:40 |
| | | */ |
| | | public interface HollowBigStorageCageMapper extends BaseMapper<HollowBigStorageCage> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | |
| | | /** |
| | | * (HollowGlassOutRelationInfo)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 13:57:28 |
| | | */ |
| | | public interface HollowGlassOutRelationInfoMapper extends BaseMapper<HollowGlassOutRelationInfo> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.HollowGlassDetailsDTO; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (HollowGlassRelationInfo)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-23 15:59:29 |
| | | */ |
| | | public interface HollowGlassRelationInfoMapper extends BaseMapper<HollowGlassRelationInfo> { |
| | | |
| | | |
| | | List<HollowGlassDetailsDTO> queryFlowCardIdMaxLayerGlassInfo(@Param("flowCardId") String flowCardId, @Param("totalLayer") int totalLayer); |
| | | |
| | | |
| | | List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(@Param("flowCardId") String flowCardId, @Param("totalLayer") int totalLayer, @Param("layer") int layer); |
| | | |
| | | List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer); |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO; |
| | | import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageDetails)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:23:12 |
| | | */ |
| | | public interface HollowBigStorageCageDetailsService extends IService<HollowBigStorageCageDetails> { |
| | | |
| | | void updateBySlot(List<UpdateHollowBigStorageCageDTO> storageCageDTOList, Integer glassStateIn); |
| | | |
| | | List<FlowCardGlassInfoDTO> hollowIsAll(String flow_card_id, Integer totalLayer, Boolean flag); |
| | | |
| | | |
| | | List<FlowCardVirtualSlotDTO> queryIsAllNeedDispatchVirtualSlot(); |
| | | |
| | | List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO); |
| | | |
| | | List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell); |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollow.entity.HollowBigStorageCage; |
| | | |
| | | /** |
| | | * (HollowBigStorageCage)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:22:45 |
| | | */ |
| | | public interface HollowBigStorageCageService extends IService<HollowBigStorageCage> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | |
| | | /** |
| | | * (HollowGlassOutRelationInfo)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 13:57:29 |
| | | */ |
| | | public interface HollowGlassOutRelationInfoService extends IService<HollowGlassOutRelationInfo> { |
| | | |
| | | HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity); |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.HollowBigStorageDTO; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * (HollowGlassRelationInfo)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-23 15:59:30 |
| | | */ |
| | | public interface HollowGlassRelationInfoService extends IService<HollowGlassRelationInfo> { |
| | | /** |
| | | * 按照玻璃id获取中空目标格子 |
| | | * |
| | | * @return |
| | | */ |
| | | HollowBigStorageDTO queryHollowTargetSlot(String flowCardId, double width, double height, int totalLayer, int layer); |
| | | |
| | | /** |
| | | * 生成中空玻璃信息 |
| | | */ |
| | | void generateHollowGlassInfo(String flowCardId, int totalLayer, int layer); |
| | | |
| | | Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard(); |
| | | |
| | | List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer); |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO; |
| | | import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO; |
| | | import com.mes.hollow.mapper.HollowBigStorageCageDetailsMapper; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageDetails)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:23:12 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class HollowBigStorageCageDetailsServiceImpl extends ServiceImpl<HollowBigStorageCageDetailsMapper, HollowBigStorageCageDetails> implements HollowBigStorageCageDetailsService { |
| | | |
| | | |
| | | @Override |
| | | public void updateBySlot(List<UpdateHollowBigStorageCageDTO> storageCageDTOList, Integer state) { |
| | | baseMapper.updateBySlot(storageCageDTOList, state); |
| | | } |
| | | |
| | | @Override |
| | | public List<FlowCardGlassInfoDTO> hollowIsAll(String flow_card_id, Integer totalLayer, Boolean flag) { |
| | | return baseMapper.hollowIsAll(flow_card_id, totalLayer, flag); |
| | | } |
| | | |
| | | @Override |
| | | public List<FlowCardVirtualSlotDTO> queryIsAllNeedDispatchVirtualSlot() { |
| | | return baseMapper.queryIsAllNeedDispatchVirtualSlot(); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO) { |
| | | return baseMapper.queryNeedDispatchSlot(flowCardVirtualSlotDTO); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell) { |
| | | return baseMapper.queryOutGlassList(flowCardId, cell); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.hollow.entity.HollowBigStorageCage; |
| | | import com.mes.hollow.mapper.HollowBigStorageCageMapper; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * (HollowBigStorageCage)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-21 09:22:46 |
| | | */ |
| | | @Service |
| | | public class HollowBigStorageCageServiceImpl extends ServiceImpl<HollowBigStorageCageMapper, HollowBigStorageCage> implements HollowBigStorageCageService { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.mapper.HollowGlassOutRelationInfoMapper; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * (HollowGlassOutRelationInfo)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 13:57:29 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class HollowGlassOutRelationInfoServiceImpl extends ServiceImpl<HollowGlassOutRelationInfoMapper, HollowGlassOutRelationInfo> implements HollowGlassOutRelationInfoService { |
| | | |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | |
| | | @Override |
| | | 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) { |
| | | log.info("该流程卡信息系统未找到"); |
| | | return info; |
| | | } |
| | | info.setFlowCardId(flowCardId); |
| | | info.setCell(cell); |
| | | info.setTotalLayer(glassInfo.getTotalLayer()); |
| | | info.setTotalLayer(glassInfo.getTotalLayer()); |
| | | info.setState(Const.HOLLOW_FLOW_CARD_NEW); |
| | | info.setTotalPairQuantity(totalPairQuantity); |
| | | this.save(info); |
| | | return info; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollow.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.hollow.entity.HollowBigStorageCage; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.HollowBigStorageDTO; |
| | | import com.mes.hollow.entity.dto.HollowGlassDetailsDTO; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import com.mes.hollow.mapper.HollowGlassRelationInfoMapper; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import com.mes.hollow.service.HollowGlassRelationInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * (HollowGlassRelationInfo)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-23 15:59:30 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class HollowGlassRelationInfoServiceImpl extends ServiceImpl<HollowGlassRelationInfoMapper, HollowGlassRelationInfo> implements HollowGlassRelationInfoService { |
| | | |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | @Resource |
| | | HollowBigStorageCageService hollowBigStorageCageService; |
| | | @Resource |
| | | HollowGlassRelationInfoService hollowGlassRelationInfoService; |
| | | @Resource |
| | | HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Override |
| | | public HollowBigStorageDTO queryHollowTargetSlot(String flowCardId, double width, double height, int totalLayer, int layer) { |
| | | //按照玻璃信息获取关系表中对应的大理片笼格子号 |
| | | HollowGlassRelationInfo relationInfoOne = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>() |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId) |
| | | .eq(HollowGlassRelationInfo::getWidth, width) |
| | | .eq(HollowGlassRelationInfo::getHeight, height) |
| | | .eq(HollowGlassRelationInfo::getLayer, layer) |
| | | .isNull(HollowGlassRelationInfo::getTemperingLayoutId) |
| | | .isNull(HollowGlassRelationInfo::getTemperingFeedSequence) |
| | | .orderByAsc(HollowGlassRelationInfo::getHollowSequence) |
| | | .last("limit 1") |
| | | ); |
| | | if (relationInfoOne == null) { |
| | | //理片笼关系表中没有对应的数据,查看理片笼虚拟位置表是否有本工程下的所有玻璃虚拟信息 |
| | | //虚拟位置表没有本工程下的所有玻璃虚拟信息,按照玻璃id生成本工程下所有玻璃的虚拟信息 |
| | | generateHollowGlassInfo(flowCardId, totalLayer, layer); |
| | | relationInfoOne = this.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>() |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId) |
| | | .eq(HollowGlassRelationInfo::getWidth, width) |
| | | .eq(HollowGlassRelationInfo::getHeight, height) |
| | | .eq(HollowGlassRelationInfo::getLayer, layer) |
| | | .isNull(HollowGlassRelationInfo::getTemperingLayoutId) |
| | | .isNull(HollowGlassRelationInfo::getTemperingFeedSequence) |
| | | .orderByAsc(HollowGlassRelationInfo::getHollowSequence) |
| | | .last("limit 1") |
| | | ); |
| | | } |
| | | HollowBigStorageCageDetails hollowDetails = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getSlot, relationInfoOne.getVirtualSlot()).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .orderByDesc(HollowBigStorageCageDetails::getSequence).last("limit 1")); |
| | | HollowBigStorageCage storageCage = null; |
| | | if (null == hollowDetails) { |
| | | storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1")); |
| | | HollowBigStorageDTO storageDTO = new HollowBigStorageDTO(); |
| | | BeanUtils.copyProperties(storageCage, storageDTO); |
| | | BeanUtils.copyProperties(relationInfoOne, storageDTO); |
| | | return storageDTO; |
| | | } |
| | | HollowGlassRelationInfo relationInfoBefore = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>() |
| | | .eq(HollowGlassRelationInfo::getEngineerId, relationInfoOne.getEngineerId()) |
| | | .eq(HollowGlassRelationInfo::getTemperingLayoutId, relationInfoOne.getTemperingLayoutId()) |
| | | .eq(HollowGlassRelationInfo::getVirtualSlot, relationInfoOne.getVirtualSlot()) |
| | | .eq(HollowGlassRelationInfo::getSlotSequence, relationInfoOne.getSlotSequence() - 1)); |
| | | if (null == relationInfoBefore) { |
| | | //表示序号没有或者 序号为1又不是第一块来的 新开一格 |
| | | storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1")); |
| | | } else { |
| | | HollowBigStorageCageDetails beforeGlass = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .eq(HollowBigStorageCageDetails::getEngineerId, relationInfoBefore.getEngineerId()) |
| | | .eq(HollowBigStorageCageDetails::getTemperingLayoutId, relationInfoBefore.getTemperingLayoutId()) |
| | | .eq(HollowBigStorageCageDetails::getTemperingFeedSequence, relationInfoBefore.getTemperingFeedSequence()) |
| | | ); |
| | | if (null == beforeGlass) { |
| | | storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1")); |
| | | } else { |
| | | storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getSlot, beforeGlass.getSlot())); |
| | | } |
| | | } |
| | | Assert.isTrue(null != storageCage, "没有空余的笼子存放玻璃"); |
| | | HollowBigStorageDTO storageDTO = new HollowBigStorageDTO(); |
| | | BeanUtils.copyProperties(storageCage, storageDTO); |
| | | BeanUtils.copyProperties(relationInfoOne, storageDTO); |
| | | return storageDTO; |
| | | } |
| | | |
| | | @Override |
| | | public void generateHollowGlassInfo(String flowCardId, int totalLayer, int layer) { |
| | | |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, flowCardId) |
| | | .eq(GlassInfo::getLayer, layer).last("limit 1")); |
| | | if (null == glassInfo) { |
| | | log.info("当前流程卡信息为导入mes系统流程卡:{},层数{}", flowCardId, layer); |
| | | return; |
| | | } |
| | | //按照流程卡获取本流程卡最后一层或第一次的玻璃数据 |
| | | List<HollowGlassDetailsDTO> glassDetailsDTOS = this.baseMapper.queryFlowCardIdMaxLayerGlassInfo(flowCardId, totalLayer); |
| | | if (CollectionUtil.isEmpty(glassDetailsDTOS)) { |
| | | log.info("当前流程卡最外层数据未找到,请在erp确认数据无误,流程卡:{},总层数{}", flowCardId, totalLayer); |
| | | return; |
| | | } |
| | | if (totalLayer != layer) { |
| | | glassDetailsDTOS = this.baseMapper.queryFlowCardIdLayerGlassInfo(flowCardId, totalLayer, layer); |
| | | } |
| | | if (CollectionUtil.isEmpty(glassDetailsDTOS)) { |
| | | log.info("当前流程卡最外层数据未找到,请在erp确认数据无误,流程卡:{},总层数{},层数{}", flowCardId, totalLayer, layer); |
| | | return; |
| | | } |
| | | ArrayList<HollowGlassDetailsDTO> tempGlassList = new ArrayList<>(); |
| | | int hollowSequence = 1; |
| | | for (HollowGlassDetailsDTO item : glassDetailsDTOS) { |
| | | for (int i = 0; i < item.getQuantity(); i++) { |
| | | HollowGlassDetailsDTO dto = new HollowGlassDetailsDTO(); |
| | | BeanUtils.copyProperties(item, dto); |
| | | dto.setHollowSequence(hollowSequence++); |
| | | tempGlassList.add(dto); |
| | | } |
| | | } |
| | | //方式一:将玻璃按流程卡、尺寸、版图、版序 依次生成虚拟格子信息,格子一直往后累加 |
| | | // flowCardIdMap.forEach((e, v) -> { |
| | | // int remainWidth = slotWidth; |
| | | // int slotNumber = 1; |
| | | // for (GlassInfo item : v) { |
| | | // int maxLength = (int) Math.max(item.getWidth(), item.getHeight()); |
| | | // if (remainWidth > maxLength) { |
| | | // remainWidth = remainWidth - maxLength - glassGap; |
| | | // } else { |
| | | // slotNumber = slotNumber + 1; |
| | | // remainWidth = slotWidth - maxLength - glassGap; |
| | | // } |
| | | // HollowGlassInfo hollow = new HollowGlassInfo(); |
| | | // BeanUtils.copyProperties(item, hollow); |
| | | // hollow.setSlot(slotNumber); |
| | | // hollowGlassInfoList.add(hollow); |
| | | // } |
| | | // }); |
| | | // this.saveBatch(hollowGlassInfoList); |
| | | //获取中空大理片笼的所有空闲格子 |
| | | // List<HollowBigStorageCage> hollowSlotList = HollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | // .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)); |
| | | //方式二:将玻璃按流程卡、尺寸、版图、版序 ,优先将格子全部补全后 依次计算后面的格子号 |
| | | List<HollowGlassRelationInfo> relationInfoList = new ArrayList(); |
| | | List<List<HollowGlassRelationInfo>> tempHollowList = new ArrayList<>(); |
| | | int slotNumber = 1; |
| | | for (HollowGlassDetailsDTO item : tempGlassList) { |
| | | boolean flag = false; |
| | | for (List<HollowGlassRelationInfo> temp : tempHollowList) { |
| | | int sum = 0; |
| | | for (HollowGlassRelationInfo i : temp) { |
| | | sum = sum + (int) Math.max(i.getHeight(), i.getWidth()) + glassGap; |
| | | } |
| | | if (sum + (int) Math.max(item.getHeight(), item.getWidth()) <= slotWidth && temp.size() < outCarMaxSize) { |
| | | HollowGlassRelationInfo hollow = new HollowGlassRelationInfo(); |
| | | BeanUtils.copyProperties(item, hollow); |
| | | hollow.setSlotSequence(temp.size() + 1); |
| | | hollow.setTotalLayer(totalLayer); |
| | | hollow.setVirtualSlot(temp.get(0).getVirtualSlot()); |
| | | hollow.setFilmsId(glassInfo.getFilmsid()); |
| | | hollow.setThickness(glassInfo.getThickness()); |
| | | temp.add(hollow); |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!flag) { |
| | | List<HollowGlassRelationInfo> newList = new ArrayList<>(); |
| | | HollowGlassRelationInfo hollow = new HollowGlassRelationInfo(); |
| | | BeanUtils.copyProperties(item, hollow); |
| | | hollow.setSlotSequence(1); |
| | | hollow.setTotalLayer(totalLayer); |
| | | hollow.setVirtualSlot(slotNumber++); |
| | | hollow.setFilmsId(glassInfo.getFilmsid()); |
| | | hollow.setThickness(glassInfo.getThickness()); |
| | | newList.add(hollow); |
| | | tempHollowList.add(newList); |
| | | } |
| | | } |
| | | for (List<HollowGlassRelationInfo> item : tempHollowList) { |
| | | relationInfoList.addAll(item); |
| | | } |
| | | log.info("分配完毕"); |
| | | this.saveBatch(relationInfoList); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard() { |
| | | List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | if (CollectionUtil.isEmpty(detailsList)) { |
| | | log.info("笼内无玻璃"); |
| | | return new HashMap<>(); |
| | | } |
| | | Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId)); |
| | | List<FlowCardGlassInfoDTO> dtos = new ArrayList<>(); |
| | | listMap.forEach((e, v) -> { |
| | | HollowBigStorageCageDetails cageDetails = v.get(0); |
| | | dtos.addAll(hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE)); |
| | | }); |
| | | return dtos.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId)); |
| | | } |
| | | |
| | | @Override |
| | | public List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer) { |
| | | |
| | | return this.baseMapper.queryLackByFlowCard(flowCardId, layer); |
| | | // return this.list(new LambdaQueryWrapper<HollowGlassRelationInfo>() |
| | | // .eq(HollowGlassRelationInfo::getFlowCardId,flowCardId) |
| | | // .eq(HollowGlassRelationInfo::getLayer,layer) |
| | | // .isNull(HollowGlassRelationInfo::getTemperingLayoutId) |
| | | // .isNull(HollowGlassRelationInfo::getTemperingFeedSequence) |
| | | // ); |
| | | } |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowqueue.controller; |
| | | |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | | import com.mes.hollowqueue.service.HollowGlassQueueInfoService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (HollowGlassQueueInfo)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 10:19:53 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("hollowGlassQueueInfo") |
| | | public class HollowGlassQueueInfoController { |
| | | |
| | | @Resource |
| | | HollowGlassQueueInfoService hollowGlassQueueInfoService; |
| | | |
| | | @ApiOperation("强制出片") |
| | | @PostMapping("/forceOutGlass") |
| | | public Result<String> forceOutGlass(String flowCardId, int cell, int totalPairQuantity) { |
| | | hollowGlassQueueInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity); |
| | | return Result.success("success"); |
| | | } |
| | | |
| | | @ApiOperation("按照线路查询正在出片的玻璃队列") |
| | | @PostMapping("/queryHollowGlassQueueInfo") |
| | | public Result<List<HollowGlassQueueInfo>> queryHollowGlassQueueInfo(int cell) { |
| | | return Result.success(hollowGlassQueueInfoService.queryHollowGlassQueueInfo(cell)); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowqueue.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.mes.base.entity.HollowBigStorageCageBaseInfo; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * (HollowGlassQueueInfo)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 10:19:55 |
| | | */ |
| | | @Data |
| | | public class HollowGlassQueueInfo extends HollowBigStorageCageBaseInfo { |
| | | /** |
| | | * /*大理片笼详情表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * /*设备id |
| | | */ |
| | | private Integer deviceId; |
| | | /** |
| | | * /*虚拟栅格号 |
| | | */ |
| | | private Integer virtualSlot; |
| | | /** |
| | | * /*栅格号 |
| | | */ |
| | | private Integer slot; |
| | | /** |
| | | * /*小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | /** |
| | | * /*流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * /*玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | /** |
| | | * /*厚度 |
| | | */ |
| | | private Double thickness; |
| | | /** |
| | | * /*状态 |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * /*玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | private String engineerId; |
| | | /** |
| | | * /*总层号 |
| | | */ |
| | | private Integer totalLayer; |
| | | /** |
| | | * /*创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * /*更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | /** |
| | | * /*中空顺序 |
| | | */ |
| | | private Integer hollowSequence; |
| | | |
| | | /** |
| | | * 路线 |
| | | */ |
| | | private Integer cell; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowqueue.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | | |
| | | /** |
| | | * (HollowGlassQueueInfo)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 10:19:54 |
| | | */ |
| | | public interface HollowGlassQueueInfoMapper extends BaseMapper<HollowGlassQueueInfo> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowqueue.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (HollowGlassQueueInfo)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 10:19:55 |
| | | */ |
| | | public interface HollowGlassQueueInfoService extends IService<HollowGlassQueueInfo> { |
| | | |
| | | void forceOutGlass(String flowCardId, int cell, int totalPairQuantity); |
| | | |
| | | List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell); |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowqueue.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | | import com.mes.hollowqueue.mapper.HollowGlassQueueInfoMapper; |
| | | import com.mes.hollowqueue.service.HollowGlassQueueInfoService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * (HollowGlassQueueInfo)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-30 10:19:56 |
| | | */ |
| | | @Service |
| | | public class HollowGlassQueueInfoServiceImpl extends ServiceImpl<HollowGlassQueueInfoMapper, HollowGlassQueueInfo> implements HollowGlassQueueInfoService { |
| | | |
| | | @Resource |
| | | HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; |
| | | |
| | | @Resource |
| | | HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService; |
| | | |
| | | @Override |
| | | 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.queryOutGlassList(flowCardId, cell); |
| | | |
| | | 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>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | this.list(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, one.getFlowCardId()) |
| | | .eq(HollowGlassQueueInfo::getCell, one.getCell()) |
| | | ); |
| | | return null; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowtask.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageHistoryTask)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-27 15:22:45 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("hollowBigStorageCageHistoryTask") |
| | | public class HollowBigStorageCageHistoryTaskController { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowtask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageHistoryTask)表实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-27 15:22:47 |
| | | */ |
| | | @Data |
| | | public class HollowBigStorageCageHistoryTask { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * /*玻璃id |
| | | */ |
| | | private String glassId; |
| | | /** |
| | | * /*起始格子 |
| | | */ |
| | | private Integer startSlot; |
| | | /** |
| | | * /*目标格子 |
| | | */ |
| | | private Integer targetSlot; |
| | | /** |
| | | * /*任务状态 |
| | | */ |
| | | private Integer taskState; |
| | | /** |
| | | * /*玻璃数量 |
| | | */ |
| | | private Integer glassCount; |
| | | /** |
| | | * /*任务类型 |
| | | */ |
| | | private Integer taskType; |
| | | /** |
| | | * /*创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * /*更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowtask.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageHistoryTask)表数据库访问层 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-27 15:22:46 |
| | | */ |
| | | public interface HollowBigStorageCageHistoryTaskMapper extends BaseMapper<HollowBigStorageCageHistoryTask> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowtask.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageHistoryTask)表服务接口 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-27 15:22:47 |
| | | */ |
| | | public interface HollowBigStorageCageHistoryTaskService extends IService<HollowBigStorageCageHistoryTask> { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.hollowtask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; |
| | | import com.mes.hollowtask.mapper.HollowBigStorageCageHistoryTaskMapper; |
| | | import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * (HollowBigStorageCageHistoryTask)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2024-11-27 15:22:48 |
| | | */ |
| | | @Service |
| | | public class HollowBigStorageCageHistoryTaskServiceImpl extends ServiceImpl<HollowBigStorageCageHistoryTaskMapper, HollowBigStorageCageHistoryTask> implements HollowBigStorageCageHistoryTaskService { |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.base.entity.HollowBigStorageCageBaseInfo; |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageTask; |
| | | import com.mes.bigstoragecagetask.service.BigStorageCageTaskService; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.hollow.entity.HollowBigStorageCage; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.*; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | | import com.mes.hollow.service.HollowGlassRelationInfoService; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | | import com.mes.hollowqueue.service.HollowGlassQueueInfoService; |
| | | import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; |
| | | import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author SNG-015 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class OpcPlcStorageCageHollowTask { |
| | | @Resource |
| | | private HollowBigStorageCageService hollowBigStorageCageService; |
| | | |
| | | @Resource |
| | | private HollowBigStorageCageHistoryTaskService hollowBigStorageCageHistoryTaskService; |
| | | @Resource |
| | | private HollowGlassRelationInfoService hollowGlassRelationInfoService; |
| | | @Resource |
| | | private HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; |
| | | @Resource |
| | | private DamageService damageService; |
| | | @Resource |
| | | private GlassInfoService glassInfoService; |
| | | @Resource |
| | | private BigStorageCageTaskService bigStorageCageTaskService; |
| | | |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Resource |
| | | 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 |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.carWidth}") |
| | | private Integer carWidth; |
| | | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2A.DLP2A.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束进片任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP2A.DLP2A.RequestMes"); |
| | | if (!"1".equals(requestEntity.getValue() + "")) { |
| | | log.info("当前未收到进片请求,结束进片任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity mesReplyEntity = miloService.readFromOpcUa("DLP2A.DLP2A.MesReply"); |
| | | if ("1".equals(mesReplyEntity.getValue() + "")) { |
| | | log.info("有正在执行的任务,结束进片任务"); |
| | | return; |
| | | } |
| | | |
| | | List<BigStorageCageTask> inTaskList = new ArrayList(); |
| | | ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP2A.DLP2A.FROM1"); |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP2A.DLP2A.DI" + i); |
| | | if (null != requestWord.getValue()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | task.setGlassId(requestWord.getValue() + ""); |
| | | task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + "")); |
| | | inTaskList.add(task); |
| | | glassIdList.add(requestWord.getValue() + ""); |
| | | continue; |
| | | } |
| | | } |
| | | if (CollectionUtil.isEmpty(inTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束进片任务"); |
| | | return; |
| | | } |
| | | log.info("获取任务的玻璃id:{}", glassIdList); |
| | | Map<String, Long> glassCountMap = glassIdList.stream().collect(Collectors.groupingBy(e -> e, Collectors.counting())); |
| | | for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) { |
| | | if (entry.getValue() > 1) { |
| | | log.info("进片玻璃{}存在相同,结束本次任务", entry.getKey()); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | } |
| | | List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>().in(HollowBigStorageCageDetails::getGlassId, glassIdList) |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | if (CollectionUtil.isNotEmpty(detailsList)) { |
| | | log.info("理片笼存在相同的进片玻璃{},结束本次任务", detailsList); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList)); |
| | | |
| | | if (glassInfoList.size() != inTaskList.size()) { |
| | | log.info("进片任务数量{}与玻璃数量{}不匹配,结束本次进片", inTaskList.size(), glassInfoList.size()); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | //修改钢化任务表中的状态 |
| | | temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .set(TemperingGlassInfo::getState, Const.TEMPERING_END).in(TemperingGlassInfo::getGlassId, glassIdList)); |
| | | |
| | | Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId)); |
| | | |
| | | //计算目标格子 |
| | | List<HollowBigStorageCageHistoryTask> historyTasks = new ArrayList<>(); |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(), |
| | | info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer()); |
| | | // 临时更新格子的剩余尺寸:防止相邻玻璃进同一格子造成剩余尺寸不足,玻璃越界的情况,任务完成后再次更新大理片笼表剩余宽度(按照笼内玻璃数量更新大理片笼剩余尺寸) |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() |
| | | .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) |
| | | .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | | historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN); |
| | | historyTask.setGlassCount(glassInfoList.size()); |
| | | historyTask.setTaskState(Const.ENGINEERING_NEW); |
| | | historyTasks.add(historyTask); |
| | | //存放详情数据 |
| | | HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); |
| | | BeanUtils.copyProperties(bigStorageDTO, cageDetails); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setSequence(bigStorageDTO.getSlotSequence()); |
| | | cageDetails.setGap(glassGap); |
| | | cageDetails.setId(null); |
| | | hollowBigStorageCageDetailsService.save(cageDetails); |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId()) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId()) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence()) |
| | | .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId()) |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId()) |
| | | .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer()) |
| | | .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot()) |
| | | .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence()) |
| | | .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence()) |
| | | ); |
| | | } |
| | | //历史数据入库 |
| | | hollowBigStorageCageHistoryTaskService.saveBatch(historyTasks); |
| | | //向opc发送启动信号 |
| | | List<ReadWriteEntity> list = new ArrayList<>(); |
| | | for (int i = 1; i <= inTaskList.size(); i++) { |
| | | list.add(generateReadWriteEntity("DLP2A.DLP2A.TO" + i, inTaskList.get(i - 1).getTargetSlot())); |
| | | } |
| | | list.add(generateReadWriteEntity("DLP2A.DLP2A.MesReply", 1)); |
| | | miloService.writeToOpcWord(list); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void outBigStorageTask() throws Exception { |
| | | Date startDate = new Date(); |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束进片任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP2B.DLP2B.RequestMes"); |
| | | if (!"1".equals(requestEntity.getValue() + "")) { |
| | | log.info("当前未收到出片请求,结束出片任务"); |
| | | return; |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | | } |
| | | |
| | | //获取空闲且领取任务的数据信息,没有任务直接走玻璃调度 |
| | | ReadWriteEntity oneEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outOneRequest"); |
| | | ReadWriteEntity twoEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outTwoRequest"); |
| | | ReadWriteEntity threeEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outThreeRequest"); |
| | | int cell = -1; |
| | | HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null; |
| | | if ("1".equals(oneEntity.getValue() + "")) { |
| | | cell = 930; |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | } |
| | | if (1 == 1 || null == hollowGlassOutRelationInfo && "1".equals(twoEntity.getValue() + "")) { |
| | | cell = 931; |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | } |
| | | if (null == hollowGlassOutRelationInfo && "1".equals(threeEntity.getValue() + "")) { |
| | | cell = 932; |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | } |
| | | if (null != hollowGlassOutRelationInfo) { |
| | | //是否允许中空 |
| | | //是否有正在中空的玻璃:中空小片表筛选未出笼的玻璃信息 |
| | | // 获取当前中空任务未完成出片的玻璃信息 |
| | | List<HollowGlassQueueInfo> unFinishHollowQueueList = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassOutRelationInfo.getFlowCardId()) |
| | | .eq(HollowGlassQueueInfo::getCell, cell) |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | .orderByAsc(HollowGlassQueueInfo::getHollowSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) { |
| | | log.info("有正在出片的中空任务"); |
| | | 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; |
| | | } else { |
| | | //将中空任务状态改为已完成 |
| | | hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getFlowCardId, hollowGlassOutRelationInfo.getFlowCardId()) |
| | | .eq(HollowGlassOutRelationInfo::getCell, hollowGlassOutRelationInfo.getCell()) |
| | | .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS)); |
| | | } |
| | | |
| | | if (redisUtil.getCacheObject("hollowSwitch")) { |
| | | List<HollowGlassOutRelationInfo> HollowGlassOutRelationInfoList = hollowGlassOutRelationInfoService |
| | | .list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW)); |
| | | for (HollowGlassOutRelationInfo e : HollowGlassOutRelationInfoList) { |
| | | //中空优先:获取理片笼 玻璃小片 破损表 数量 判断笼内版图是否到齐 |
| | | List<FlowCardGlassInfoDTO> flowCardGlassInfoDTO = hollowBigStorageCageDetailsService.hollowIsAll(e.getFlowCardId(), e.getTotalLayer(), Boolean.TRUE); |
| | | if (CollectionUtil.isNotEmpty(flowCardGlassInfoDTO)) { |
| | | //玻璃到齐包括已出片的 |
| | | //到齐,将玻璃小片数据存入中空小片表,逻辑生成出片任务 结束 |
| | | for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) { |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell); |
| | | int finalCell = cell; |
| | | List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> { |
| | | HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | | BeanUtils.copyProperties(queue, queueInfo); |
| | | queueInfo.setState(Const.TEMPERING_NEW); |
| | | queueInfo.setCell(finalCell); |
| | | return queueInfo; |
| | | }).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(hollowQueues)) { |
| | | hollowGlassQueueInfoService.saveBatch(hollowQueues); |
| | | Integer isPair = hollowQueues.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer()); |
| | | //将中空任务状态改为开始 |
| | | hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId()) |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // redisUtil.setCacheObject("dispatchHollowSwitch",true); |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | | if (redisUtil.getCacheObject("dispatchHollowSwitch")) { |
| | | //todo:获取笼内单格已经到齐的玻璃格子信息 |
| | | List<FlowCardVirtualSlotDTO> virtualList = hollowBigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot(); |
| | | if (CollectionUtil.isEmpty(virtualList)) { |
| | | log.info("没有需要调度的格子"); |
| | | return; |
| | | } |
| | | List<HollowBigStorageCageDetails> list = new ArrayList<>(); |
| | | loop: |
| | | for (FlowCardVirtualSlotDTO dto : virtualList) { |
| | | List<BigStorageSequenceDTO> sequenceDTOList = hollowBigStorageCageDetailsService.queryNeedDispatchSlot(dto); |
| | | if (CollectionUtil.isEmpty(sequenceDTOList) || sequenceDTOList.size() == 1) { |
| | | continue; |
| | | } |
| | | int sequence = -1; |
| | | int startSlot = -1; |
| | | for (BigStorageSequenceDTO item : sequenceDTOList) { |
| | | if (item.getMinSequence() == sequence + 1) { |
| | | //生成调度任务 |
| | | int targetSlot = item.getSlot(); |
| | | list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(HollowBigStorageCageDetails::getSlot, startSlot)); |
| | | hollowOutGlassByIsPair(list, targetSlot, 0, 0); |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | slotList.add(targetSlot); |
| | | updateSlotRemainBySlots(slotList); |
| | | break loop; |
| | | } |
| | | sequence = item.getMaxSequence(); |
| | | startSlot = item.getSlot(); |
| | | } |
| | | } |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishInBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2A.DLP2A.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束完成进片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> inTaskList = new ArrayList(); |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | ReadWriteEntity toWord = miloService.readFromOpcUa("DLP2A.DLP2A.TO1"); |
| | | if ("0".equals(toWord.getValue() + "")) { |
| | | log.info("完成任务已执行,结束本次完成进片任务"); |
| | | return; |
| | | } |
| | | for (int i = 1; i <= 6; i++) { |
| | | ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP2A.DLP2A.DI" + i); |
| | | ReadWriteEntity statetWord = miloService.readFromOpcUa("DLP2A.DLP2A.STATE" + i); |
| | | ReadWriteEntity toOpcUa = miloService.readFromOpcUa("DLP2A.DLP2A.TO" + i); |
| | | ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP2A.DLP2A.FROM" + i); |
| | | |
| | | if (null != requestWord.getValue()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | task.setGlassId(requestWord.getValue() + ""); |
| | | task.setTargetSlot(Integer.parseInt(toOpcUa.getValue() + "")); |
| | | task.setTaskState(Integer.parseInt(statetWord.getValue() + "")); |
| | | task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + "")); |
| | | inTaskList.add(task); |
| | | glassIdList.add(requestWord.getValue() + ""); |
| | | continue; |
| | | } |
| | | } |
| | | if (CollectionUtil.isEmpty(inTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = inTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(unFinishTaskList)) { |
| | | log.info("存在未完成的玻璃信息,玻璃:{}", unFinishTaskList); |
| | | return; |
| | | } |
| | | Map<Integer, List<BigStorageCageTask>> taskMap = inTaskList.stream().collect(Collectors.groupingBy(BigStorageCageTask::getTaskState)); |
| | | //按照任务状态修改大理片笼内的玻璃数据 |
| | | // 重新计算大理片笼内的剩余尺寸 |
| | | taskMap.forEach((e1, v) -> { |
| | | if (e1 == 2) { |
| | | //进片完成 |
| | | log.info("3、获取进片已完成的玻璃信息id:{}", v); |
| | | List<Integer> inSuccessGlassSlot = v.stream().map(BigStorageCageTask::getTargetSlot).collect(Collectors.toList()); |
| | | List<UpdateHollowBigStorageCageDTO> storageCageDTOList = v.stream().map(e -> { |
| | | UpdateHollowBigStorageCageDTO storageCageDTO = new UpdateHollowBigStorageCageDTO(); |
| | | BeanUtils.copyProperties(e, storageCageDTO); |
| | | return storageCageDTO; |
| | | }).collect(Collectors.toList()); |
| | | hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN); |
| | | log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", v); |
| | | updateSlotRemainBySlots(inSuccessGlassSlot); |
| | | } else if (e1 == 3) { |
| | | //破损处理 |
| | | dealDamageInTask(v); |
| | | } else { |
| | | //清空理片笼空数据 |
| | | noDealInTask(v); |
| | | } |
| | | }); |
| | | for (BigStorageCageTask item : inTaskList) { |
| | | //更新历史任务表中的任务状态 |
| | | hollowBigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<HollowBigStorageCageHistoryTask>() |
| | | .set(HollowBigStorageCageHistoryTask::getTaskState, item.getTaskState()) |
| | | .eq(HollowBigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_AFTER_IN) |
| | | .eq(HollowBigStorageCageHistoryTask::getTargetSlot, item.getTargetSlot()) |
| | | .eq(HollowBigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | item.setTargetSlot(0); |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | } |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | //向opc发送启动信号 |
| | | List<ReadWriteEntity> list = new ArrayList<>(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | list.add(generateReadWriteEntity("DLP2A.DLP2A.TO" + i, 0)); |
| | | } |
| | | list.add(generateReadWriteEntity("DLP2A.DLP2A.MesReply", 0)); |
| | | miloService.writeToOpcWord(list); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishOutBigStorageTask() throws Exception { |
| | | ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl"); |
| | | if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("当前为非联机状态,结束完成出片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = outTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(unFinishTaskList)) { |
| | | log.info("存在未完成的玻璃信息,玻璃:{}", unFinishTaskList); |
| | | return; |
| | | } |
| | | Map<Integer, List<BigStorageCageTask>> taskMap = outTaskList.stream().collect(Collectors.groupingBy(BigStorageCageTask::getTaskState)); |
| | | int taskType = 0; |
| | | if (Const.OUT_TARGET_POSITION_ALL.contains(outTaskList.get(0).getTargetSlot())) { |
| | | taskType = Const.BIG_STORAGE_AFTER_OUT; |
| | | } else { |
| | | taskType = Const.BIG_STORAGE_AFTER_DISPATCH; |
| | | } |
| | | //按照任务状态修改大理片笼内的玻璃数据 |
| | | // 重新计算大理片笼内的剩余尺寸 |
| | | Integer finalTaskType = taskType; |
| | | taskMap.forEach((e1, v) -> { |
| | | if (e1 == 2) { |
| | | //进片完成 |
| | | log.info("3、获取进片已完成的玻璃信息id:{}", v); |
| | | List<Integer> outSuccessGlassSlot = new ArrayList<>(); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT)) { |
| | | outSuccessGlassSlot = v.stream().map(BigStorageCageTask::getStartSlot).collect(Collectors.toList()); |
| | | } else { |
| | | List<Integer> targetSuccessGlassSlot = v.stream().map(BigStorageCageTask::getTargetSlot).collect(Collectors.toList()); |
| | | List<Integer> startoutSuccessGlassSlot = v.stream().map(BigStorageCageTask::getStartSlot).collect(Collectors.toList()); |
| | | outSuccessGlassSlot.addAll(targetSuccessGlassSlot); |
| | | outSuccessGlassSlot.addAll(startoutSuccessGlassSlot); |
| | | } |
| | | List<UpdateHollowBigStorageCageDTO> storageCageDTOList = v.stream().map(e -> { |
| | | UpdateHollowBigStorageCageDTO storageCageDTO = new UpdateHollowBigStorageCageDTO(); |
| | | storageCageDTO.setGlassId(e.getGlassId()); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT)) { |
| | | storageCageDTO.setTargetSlot(e.getStartSlot()); |
| | | } else { |
| | | storageCageDTO.setTargetSlot(e.getTargetSlot()); |
| | | } |
| | | return storageCageDTO; |
| | | }).collect(Collectors.toList()); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT)) { |
| | | hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT); |
| | | } else { |
| | | hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN); |
| | | } |
| | | log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", v); |
| | | updateSlotRemainBySlots(outSuccessGlassSlot); |
| | | } else if (e1 == 3) { |
| | | //破损处理 |
| | | dealDamageOutTask(v); |
| | | } else { |
| | | //清空理片笼空数据 |
| | | noDealOutTask(v); |
| | | } |
| | | }); |
| | | for (BigStorageCageTask item : outTaskList) { |
| | | //更新历史任务表中的任务状态 |
| | | hollowBigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<HollowBigStorageCageHistoryTask>() |
| | | .set(HollowBigStorageCageHistoryTask::getTaskState, item.getTaskState()) |
| | | .eq(HollowBigStorageCageHistoryTask::getTaskType, taskType) |
| | | .eq(HollowBigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | //更新中空小片表 |
| | | Integer taskState = item.getTaskState(); |
| | | if (taskState == 2) { |
| | | hollowGlassQueueInfoService.update(new LambdaUpdateWrapper<HollowGlassQueueInfo>() |
| | | .set(HollowGlassQueueInfo::getState, Const.TEMPERING_OUT).eq(HollowGlassQueueInfo::getGlassId, item.getGlassId())); |
| | | } else if (taskState == 3) { |
| | | // temperingGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getGlassId, item.getGlassId())); |
| | | hollowGlassQueueInfoService.update(new LambdaUpdateWrapper<HollowGlassQueueInfo>() |
| | | .set(HollowGlassQueueInfo::getState, Const.TEMPERING_DAMAGE).eq(HollowGlassQueueInfo::getGlassId, item.getGlassId())); |
| | | |
| | | } else { |
| | | // 空执行 |
| | | } |
| | | } |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 0)); |
| | | } |
| | | |
| | | private void dealDamageInTask(List<BigStorageCageTask> damageTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", damageTaskList); |
| | | //移除理片笼详情表任务执行过程中破损的玻璃 |
| | | hollowBigStorageCageDetailsService.remove(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_NEW) |
| | | .in(HollowBigStorageCageDetails::getGlassId, damageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()))); |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : damageTaskList) { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(item.getGlassId()); |
| | | damage.setLine(item.getStartSlot()); |
| | | damage.setWorkingProcedure("磨边"); |
| | | damage.setRemark("进笼前卧转立"); |
| | | damage.setStatus(1); |
| | | damage.setType(item.getTaskState()); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(item.getTargetSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("进片任务-破损任务执行完成"); |
| | | } |
| | | |
| | | private void dealDamageOutTask(List<BigStorageCageTask> damageTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", damageTaskList); |
| | | //移除理片笼详情表任务执行过程中破损的玻璃 |
| | | hollowBigStorageCageDetailsService.remove(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .in(HollowBigStorageCageDetails::getGlassId, damageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()))); |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : damageTaskList) { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(item.getGlassId()); |
| | | damage.setLine(item.getStartSlot()); |
| | | damage.setWorkingProcedure("中空前"); |
| | | damage.setRemark("进笼后卧转立"); |
| | | damage.setStatus(1); |
| | | damage.setType(item.getTaskState()); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(item.getTargetSlot()); |
| | | slotList.add(item.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("出片任务-破损任务执行完成"); |
| | | } |
| | | |
| | | private void noDealInTask(List<BigStorageCageTask> noDealTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", noDealTaskList); |
| | | //移除理片笼详情表未执行任务的空记录信息 |
| | | hollowBigStorageCageDetailsService.remove(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_NEW) |
| | | .in(HollowBigStorageCageDetails::getGlassId, noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()))); |
| | | //记录格子号,按格子号更新剩余尺寸 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : noDealTaskList) { |
| | | slotList.add(item.getTargetSlot()); |
| | | slotList.add(item.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("进片任务-无动作执行完成"); |
| | | } |
| | | |
| | | private void noDealOutTask(List<BigStorageCageTask> noDealTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", noDealTaskList); |
| | | if (Const.OUT_TARGET_POSITION_ALL.contains(noDealTaskList.get(0).getTargetSlot())) { |
| | | //出片任务:将出片中状态恢复为在笼内 |
| | | List<String> glassList = noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() |
| | | .set(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(HollowBigStorageCageDetails::getGlassId, glassList)); |
| | | |
| | | } else { |
| | | //调度任务:将调度中状态改为在笼内,格子号恢复为调度前的格子 |
| | | for (BigStorageCageTask item : noDealTaskList) { |
| | | hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() |
| | | .set(HollowBigStorageCageDetails::getSlot, item.getStartSlot()) |
| | | .set(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .eq(HollowBigStorageCageDetails::getGlassId, item.getGlassId())); |
| | | } |
| | | } |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageTask item : noDealTaskList) { |
| | | slotList.add(item.getTargetSlot()); |
| | | slotList.add(item.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | 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 <T> |
| | | * @param list |
| | | * @param totalLayer |
| | | * @return |
| | | */ |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer) { |
| | | //任务数据:获取车子存放玻璃最大数量,玻璃间隔 |
| | | List<BigStorageCageTask> tempList = new ArrayList<>(); |
| | | List<T> tempTList = new ArrayList<>(); |
| | | //打车剩余尺寸 |
| | | Integer remainWidth = carWidth; |
| | | for (T e : list) { |
| | | 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; |
| | | tempTList.add(e); |
| | | tempList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot, |
| | | 0)); |
| | | } |
| | | 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补全 |
| | | while (bigStorageCageTaskList.size() < 6) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll(tableName); |
| | | bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | List<HollowBigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | HollowBigStorageCageHistoryTask history = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(e, history); |
| | | history.setGlassCount(glassCount); |
| | | history.setTaskType(taskType); |
| | | return history; |
| | | }).collect(Collectors.toList()); |
| | | hollowBigStorageCageHistoryTaskService.saveBatch(historyList); |
| | | |
| | | log.info("将出片玻璃{}玻璃状态改为出片中", glassIds); |
| | | hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() |
| | | .set(HollowBigStorageCageDetails::getState, state) |
| | | .set(Const.BIG_STORAGE_AFTER_DISPATCH.equals(taskType), HollowBigStorageCageDetails::getSlot, targetSlot) |
| | | .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(HollowBigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 1)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | public void updateSlotRemainBySlots(List<Integer> slotList) { |
| | | //获取格子内所有的玻璃信息 |
| | | List<HollowBigStorageCageDetails> inSlotGlassList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .in(HollowBigStorageCageDetails::getSlot, slotList).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | Map<Integer, Double> slotRemainMap = new HashMap<>(); |
| | | //是否存在有格子非空的玻璃 |
| | | if (CollectionUtils.isNotEmpty(inSlotGlassList)) { |
| | | //存在 将格子内的玻璃分别进行更新 |
| | | slotRemainMap = inSlotGlassList.stream() |
| | | .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getSlot, Collectors.summingDouble(item -> Math.max(item.getWidth(), item.getHeight()) + glassGap))); |
| | | slotRemainMap.forEach((e, v) -> { |
| | | double remainWidth = slotWidth - v >= 0 ? slotWidth - v : 0; |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>().set(HollowBigStorageCage::getRemainWidth, remainWidth) |
| | | .eq(HollowBigStorageCage::getSlot, e)); |
| | | }); |
| | | } |
| | | //过滤不存在玻璃的格子 将宽度重置为原始宽度6200 |
| | | Set<Integer> remainSlotList = slotRemainMap.keySet(); |
| | | slotList.removeAll(remainSlotList); |
| | | if (CollectionUtils.isNotEmpty(slotList)) { |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>().set(HollowBigStorageCage::getRemainWidth, slotWidth) |
| | | .in(HollowBigStorageCage::getSlot, slotList)); |
| | | } |
| | | } |
| | | |
| | | private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) { |
| | | return ReadWriteEntity.builder() |
| | | .identifier(identifier) |
| | | //Kep中是Long类型,即:Int32,Java中的int类型 |
| | | .value(value) |
| | | .build(); |
| | | } |
| | | // |
| | | // private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) { |
| | | //// if (target == 931){} |
| | | // if (taskList.get(0).get) |
| | | // return null; |
| | | // } |
| | | } |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.1.199:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://192.168.10.2:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | pp: |
| | | url: jdbc:mysql://192.168.1.199:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | pp: |
| | | url: jdbc:mysql://127.0.0.1:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | pp: |
| | | url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://192.168.2.100:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://192.168.2.100:1433;databasename=mes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.2.100:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.2.100 |
| | | port: 6379 |
| | | password: 123456 |
| New file |
| | |
| | | server: |
| | | port: 8181 |
| | | |
| | | spring: |
| | | profiles: |
| | | active: yw |
| | | application: |
| | | name: hollowGlass |
| | | liquibase: |
| | | enabled: false |
| | | task: |
| | | scheduling: |
| | | pool: |
| | | size: 10 |
| | | thread-name-prefix: task-hollowGlass |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | mes: |
| | | sequence: |
| | | order: true |
| | | minCount: 30 |
| | | carWidth: 6200 #大车宽度 |
| | | slotWidth: 6200 #大车宽度 |
| | | inCarMaxSize: 5 #进片大车最大存放玻璃数量 |
| | | outCarMaxSize: 6 #出片大车最大存放玻璃数量 |
| | | glassGap: 250 #玻璃间距 |
| | | xMaxSize: 2800 |
| | | temperingOutTargetPosition: 930 |
| | | artificialOutTargetPosition: 931 |
| | | |
| | | scan: |
| | | ip: 192.168.30.199 |
| | | port: 5000 |
| | | kangaroohy: |
| | | milo: |
| | | enabled: true |
| | | primary: default |
| | | config: |
| | | default: |
| | | endpoint: opc.tcp://192.168.2.100:49320 |
| | | security-policy: basic256sha256 |
| | | username: admin |
| | | password: 1qaz2wsx3edc4rfv |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration scan="true" scanPeriod="10 seconds"> |
| | | <!-- logger上下文名称(根据业务修改) --> |
| | | <contextName>cacheVerticalGlass</contextName> |
| | | |
| | | <!-- 定义了一个名为serverName的属性,它的值来自于logging.file.name,如果没有找到该属性默认为MyServerName(根据业务修改) --> |
| | | <springProperty name="serverName" source="logging.file.name" defaultValue="hollowGlass"/> |
| | | <springProperty name="logging.path" source="logging.file.path" defaultValue="././logs/"/> |
| | | |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | | <!-- 定义了一个名为clr的转换规则,它使用org.springframework.boot.logging.logback.ColorConverter类进行转换,这个元素通常用于将日志输出中的文本着色,以便更容易地区分不同的日志级别或其他信息 --> |
| | | <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
| | | <!-- WhitespaceThrowableProxyConverter和ExtendedWhitespaceThrowableProxyConverter都是用于将异常信息转换为字符串,并将其中的换行符替换为空格,以便更容易地在日志输出中显示的类。它们之间的区别在于,ExtendedWhitespaceThrowableProxyConverter在输出异常信息时会包含更多的详细信息,例如异常的类名、方法名和行号等 --> |
| | | <!-- 定义了一个名为wex的转换规则,它使用org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter类进行转换,这个元素通常用于将异常信息转换为字符串,并将其中的换行符替换为空格,以便更容易地在日志输出中显示 --> |
| | | <conversionRule conversionWord="wex" |
| | | converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
| | | <!-- 定义了一个名为wEx的转换规则,它使用org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter类进行转换,这个元素通常用于将异常信息转换为字符串,并将其中的换行符替换为空格,以便更容易地在日志输出中显示 --> |
| | | <conversionRule conversionWord="wEx" |
| | | converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
| | | |
| | | <!-- 彩色日志格式 --> |
| | | <!-- value值是日志输出模板, :-是属性名和其默认值之间的分隔符,作用与:相同 --> |
| | | <!-- 定义日志输出格式的转换规则,%d{yyyy-MM-dd HH:mm:ss.SSS}表示日期和时间,%clr表示将输出文本着色,{faint}表示使用淡色 --> |
| | | <!-- %5p表示日志级别输出右对齐,左边以空格填充 --> |
| | | <!-- ${PID:- }表示进程ID,%clr表示将输出文本着色,{magenta}表示使用洋红色 --> |
| | | <!-- -表示一个分隔符 --> |
| | | <!-- %t:显示产生该日志的线程名;%15:若字符长度小于15,则左边用空格填充;%.15:若字符长度超过15,截去多余字符 --> |
| | | <!-- %-40:若字符长度小于40,则右边用空格填充;%.40:若字符长度超过40,截去多余字符;logger{39}对应的是“logging.WARNING”级别。具体来说,Python的logging模块定义了以下几个级别(从低到高):NOTSET、DEBUG、INFO、WARNING、ERROR、CRITICAL。因此,logger{39}表示的是WARNING级别,即日志记录器会记录所有WARNING级别及以上的日志信息 --> |
| | | <!-- %m表示日志消息;%n表示换行符;${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}表示异常信息。如果日志输出中包含异常信息,这个规则将会将其转换为字符串,并将其中的换行符替换为空格,以便更容易地在日志输出中显示 --> |
| | | <property name="CONSOLE_LOG_PATTERN" |
| | | value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
| | | |
| | | <!--1. 输出到控制台--> |
| | | <!-- 定义控制台日志输出的appender,class="ch.qos.logback.core.ConsoleAppender"表示使用Logback框架提供的ConsoleAppender类来输出日志到控制台 --> |
| | | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
| | | <!-- 定义日志输出级别的过滤器,class="ch.qos.logback.classic.filter.ThresholdFilter"表示使用Logback框架提供的ThresholdFilter类来过滤日志输出,<level>debug</level>表示只输出debug级别及以上的日志 --> |
| | | <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
| | | <level>debug</level> |
| | | </filter> |
| | | <encoder> |
| | | <!-- ${CONSOLE_LOG_PATTERN}表示控制台日志输出格式,UTF-8表示编码格式 --> |
| | | <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
| | | <!-- 设置字符集 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | <!--2. 输出到文档--> |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <!-- 定义文件日志输出的appender,class="ch.qos.logback.core.rolling.RollingFileAppender"表示使用Logback框架提供的RollingFileAppender类来输出日志到文件 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${logging.path}/${serverName}/web_debug.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <!-- 定义日志文件滚动策略的标签,class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"表示使用Logback框架提供的TimeBasedRollingPolicy类来定义日志文件的滚动策略 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志归档 --> |
| | | <!-- 定义日志文件名的模式。在这个模式中,${logging.path}表示日志文件的路径,%d{yyyy-MM-dd}表示日期格式,%i表示文件索引 --> |
| | | <fileNamePattern>${logging.path}/${serverName}/web-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <!-- 定义日志文件滚动策略的标签,class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"表示使用Logback框架提供的SizeAndTimeBasedFNATP类来定义日志文件的滚动策略,<maxFileSize>100MB</maxFileSize>表示日志文件的最大大小为100MB。这个滚动策略通常用于按照时间和文件大小滚动日志文件,以便更好地管理日志文件的大小和数量 --> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录debug级别的 --> |
| | | <!-- 定义日志输出级别的过滤器。在这个过滤器中,class="ch.qos.logback.classic.filter.LevelFilter"表示使用Logback框架提供的LevelFilter类来过滤日志输出,<level>debug</level>表示只输出debug级别及以上的日志 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>debug</level> |
| | | <!-- <onMatch>ACCEPT</onMatch>表示如果日志事件与过滤器匹配,则接受该事件,<onMismatch>DENY</onMismatch>表示如果日志事件与过滤器不匹配,则拒绝该事件 --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${logging.path}/${serverName}/web_info.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 天天日志归档路径以及格式 --> |
| | | <fileNamePattern>${logging.path}/${serverName}/web-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录info级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>info</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${logging.path}/${serverName}/web_warn.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${logging.path}/${serverName}/web-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录warn级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>warn</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${logging.path}/${serverName}/web_error.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${logging.path}/${serverName}/web-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录ERROR级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | <!-- 4.1 开发环境:打印控制台--> |
| | | <!-- 用于在Spring Boot应用程序中配置日志记录的标签。在这个标签中,name="dev"表示这个配置文件只在dev环境中生效,<logger name="com.myClass.controller" level="debug"/>表示为com.myClass.controller(根据业务修改)这个包下的类配置日志输出级别为debug --> |
| | | <!-- <springProfile name="dev">--> |
| | | <!-- <logger name="com.myClass.controller" level="debug"/>--> |
| | | <!-- </springProfile>--> |
| | | <!-- 用于配置日志输出的标签。在这个标签中,level="info"表示日志输出级别为info,<appender-ref ref="CONSOLE"/>、<appender-ref ref="DEBUG_FILE"/>、<appender-ref ref="INFO_FILE"/>、<appender-ref ref="WARN_FILE"/>、<appender-ref ref="ERROR_FILE"/>表示将日志输出到不同的appender中,分别为控制台、debug文件、info文件、warn文件和error文件 --> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE"/> |
| | | <appender-ref ref="DEBUG_FILE"/> |
| | | <appender-ref ref="INFO_FILE"/> |
| | | <appender-ref ref="WARN_FILE"/> |
| | | <appender-ref ref="ERROR_FILE"/> |
| | | </root> |
| | | </configuration> |
| New file |
| | |
| | | <?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.hollow.mapper.HollowBigStorageCageDetailsMapper"> |
| | | |
| | | <resultMap id="baseMap" type="com.mes.hollow.entity.dto.FlowCardGlassInfoDTO"> |
| | | <result column="engineer_id" property="engineerId"/> |
| | | <result column="flow_card_id" property="flowCardId"/> |
| | | <result column="layer" property="layer"/> |
| | | <result column="sum_count" property="sumCount"/> |
| | | <result column="pair_count" property="pairCount"/> |
| | | <result column="real_count" property="realCount"/> |
| | | <result column="damage_count" property="damageCount"/> |
| | | <result column="lack_count" property="lackCount"/> |
| | | </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"> |
| | | <result column="slot" property="slot"/> |
| | | <result column="max_sequence" property="maxSequence"/> |
| | | <result column="min_sequence" property="minSequence"/> |
| | | </resultMap> |
| | | |
| | | <update id="updateBySlot"> |
| | | update hollow_big_storage_cage_details |
| | | <set> |
| | | state = #{state} |
| | | </set> |
| | | <where> |
| | | (glass_id,slot) in ( |
| | | <foreach collection="list" item="item" separator=","> |
| | | (#{item.glassId}, #{item.targetSlot}) |
| | | </foreach> |
| | | ) |
| | | and state !=101 |
| | | </where> |
| | | </update> |
| | | |
| | | <select id="hollowIsAll" resultMap="baseMap"> |
| | | WITH sum_flow_layer_count AS ( |
| | | SELECT |
| | | flow_card_id, |
| | | layer, |
| | | min( films_id ) AS films_id, |
| | | count(*) AS sum_count |
| | | FROM |
| | | hollow_glass_relation_info |
| | | GROUP BY |
| | | flow_card_id, |
| | | layer |
| | | ), |
| | | real_flow_layer_count AS ( |
| | | SELECT |
| | | flow_card_id, |
| | | layer, |
| | | count(*) AS real_count |
| | | FROM |
| | | hollow_glass_relation_info |
| | | WHERE |
| | | tempering_layout_id IS NOT NULL |
| | | AND tempering_feed_sequence IS NOT NULL |
| | | GROUP BY |
| | | flow_card_id, |
| | | layer |
| | | ), |
| | | damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*) |
| | | damage_count FROM damage GROUP BY process_id, technology_number ), |
| | | lack_flow_layer_count AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | ( sum_count - real_count - damage_count ) AS lack_count |
| | | FROM |
| | | sum_flow_layer_count t |
| | | INNER JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id |
| | | AND t.layer = t1.layer |
| | | INNER JOIN damage_flow_layer_count t2 ON t1.flow_card_id = t2.flow_card_id |
| | | AND t1.layer = t2.layer |
| | | ), |
| | | layer_one AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 1 AND tempering_layout_id IS NOT NULL AND |
| | | tempering_feed_sequence IS NOT NULL ), |
| | | layer_two AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 2 AND tempering_layout_id IS NOT NULL AND |
| | | tempering_feed_sequence IS NOT NULL ), |
| | | layer_three AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 3 AND tempering_layout_id IS NOT NULL |
| | | AND tempering_feed_sequence IS NOT NULL ) |
| | | , |
| | | pair_flow_layer_count AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | count(*) AS pair_count |
| | | FROM |
| | | layer_one t |
| | | INNER JOIN layer_two t1 ON t.flow_card_id = t1.flow_card_id |
| | | AND t.virtual_slot = t1.virtual_slot |
| | | AND t.slot_sequence = t1.slot_sequence |
| | | <if test="totalLayer == 3"> |
| | | inner join layer_three t2 |
| | | on t.flow_card_id = t2.flow_card_id and |
| | | t.virtual_slot = t2.virtual_slot and t.slot_sequence = t2.slot_sequence |
| | | </if> |
| | | GROUP BY |
| | | t.flow_card_id |
| | | ) |
| | | ,result_flow_layer_count AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.films_id, |
| | | sum_count, |
| | | t3.pair_count, |
| | | IFNULL(real_count,0) as real_count, |
| | | IFNULL(damage_count,0) as damage_count, |
| | | IFNULL(lack_count,0) as lack_count |
| | | FROM |
| | | sum_flow_layer_count t |
| | | left JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id |
| | | AND t.layer = t1.layer |
| | | left JOIN lack_flow_layer_count t2 ON t.flow_card_id = t2.flow_card_id |
| | | AND t.layer = t2.layer |
| | | left JOIN pair_flow_layer_count t3 ON t.flow_card_id = t3.flow_card_id |
| | | left JOIN damage_flow_layer_count t4 ON t.flow_card_id = t4.flow_card_id |
| | | AND t.layer = t4.layer |
| | | ) SELECT |
| | | * |
| | | FROM |
| | | result_flow_layer_count |
| | | WHERE |
| | | flow_card_id = #{flowCardId} |
| | | <if test="flag == true"> |
| | | and sum_count = pair_count |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO"> |
| | | with relation_temp as ( |
| | | select flow_card_id, layer, virtual_slot, count(1) as slot_count |
| | | from hollow_glass_relation_info |
| | | group by flow_card_id, layer, virtual_slot |
| | | ), |
| | | details_temp as ( |
| | | 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, 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, layer, virtual_slot |
| | | from result_one |
| | | order by flow_card_id, layer, virtual_slot |
| | | </select> |
| | | |
| | | <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO"> |
| | | select slot, max(sequence) as max_sequence, min(sequence) as min_sequence |
| | | 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> |
| New file |
| | |
| | | <?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.hollow.mapper.HollowGlassRelationInfoMapper"> |
| | | |
| | | <resultMap id="baseMap" type="com.mes.hollow.entity.dto.HollowGlassDetailsDTO"> |
| | | <result column="process_id" property="flowCardId"/> |
| | | <result column="child_width" property="width"/> |
| | | <result column="child_height" property="height"/> |
| | | <result column="order_number" property="orderSort"/> |
| | | <result column="technology_number" property="layer"/> |
| | | <result column="quantity" property="quantity"/> |
| | | </resultMap> |
| | | <resultMap id="lackBaseMap" type="com.mes.hollow.entity.dto.LackDetailsDTO"> |
| | | <result column="flow_card_id" property="flowCardId"/> |
| | | <result column="layer" property="layer"/> |
| | | <result column="films_id" property="filmsId"/> |
| | | <result column="first_length" property="width"/> |
| | | <result column="second_Length" property="height"/> |
| | | <result column="thickness" property="thickness"/> |
| | | <result column="lack_cout" property="lackCount"/> |
| | | </resultMap> |
| | | <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMap"> |
| | | with temp_flow as (SELECT t.process_id, |
| | | t.order_id, |
| | | t.order_number, |
| | | t.technology_number, |
| | | t.quantity, |
| | | t1.child_width, |
| | | t1.child_height |
| | | |
| | | from pp.flow_card t |
| | | LEFT JOIN sd.order_glass_detail t1 |
| | | on t.order_id = t1.order_id |
| | | and t.order_number = t1.order_number |
| | | and t.technology_number = t1.technology_number |
| | | where t.process_id = #{flowCardId}), |
| | | glass_info_temp as ( |
| | | select process_id, |
| | | order_id, |
| | | GREATEST(child_width, child_height) as first_length, |
| | | least(child_width, child_height) as second_length, |
| | | child_width, |
| | | child_height, |
| | | order_number, |
| | | technology_number, |
| | | quantity |
| | | from temp_flow |
| | | where technology_number = #{totalLayer} |
| | | ) |
| | | select row_number() over (order by second_length desc,first_length desc) as rn, t.* |
| | | from glass_info_temp t |
| | | </select> |
| | | |
| | | <select id="queryFlowCardIdLayerGlassInfo" resultMap="baseMap"> |
| | | with temp_flow as (SELECT t.process_id, |
| | | t.order_id, |
| | | t.order_number, |
| | | t.technology_number, |
| | | t.quantity, |
| | | t1.child_width, |
| | | t1.child_height |
| | | |
| | | from pp.flow_card t |
| | | LEFT JOIN sd.order_glass_detail t1 |
| | | on t.order_id = t1.order_id |
| | | and t.order_number = t1.order_number |
| | | and t.technology_number = t1.technology_number |
| | | where t.process_id = #{flowCardId}), |
| | | glass_info_max_layer_temp as ( |
| | | select process_id, |
| | | order_id, |
| | | GREATEST(child_width, child_height) as first_length, |
| | | least(child_width, child_height) as second_length, |
| | | child_width, |
| | | child_height, |
| | | order_number, |
| | | technology_number, |
| | | quantity |
| | | from temp_flow |
| | | where technology_number = #{totalLayer} |
| | | ), |
| | | glass_info_layer_temp as ( |
| | | select process_id, |
| | | order_id, |
| | | GREATEST(child_width, child_height) as first_length, |
| | | least(child_width, child_height) as second_length, |
| | | child_width, |
| | | child_height, |
| | | order_number, |
| | | technology_number, |
| | | quantity |
| | | from temp_flow |
| | | where technology_number = #{layer} |
| | | ), |
| | | max_layer_sequence as ( |
| | | select row_number() over (order by second_length desc,first_length desc) as rn, t.order_number |
| | | from glass_info_max_layer_temp t |
| | | ), |
| | | result as (select t.* |
| | | from glass_info_layer_temp t |
| | | INNER join max_layer_sequence t1 on t.order_number = t1.order_number |
| | | order by t1.rn) |
| | | select * |
| | | from result |
| | | </select> |
| | | <select id="queryLackByFlowCard" resultMap="lackBaseMap"> |
| | | with relation_length as ( |
| | | select flow_card_id, |
| | | layer, |
| | | tempering_layout_id, |
| | | tempering_feed_sequence, |
| | | GREATEST(width, height) as first_length, |
| | | LEAST(width, height) as second_Length, |
| | | width, |
| | | height, |
| | | thickness, |
| | | films_id |
| | | from hollow_glass_relation_info |
| | | where flow_card_id = #{flowCardId} |
| | | and tempering_layout_id is null |
| | | and tempering_feed_sequence is null |
| | | ) |
| | | select flow_card_id, layer, first_length, films_id, second_Length, thickness, count(*) as lack_cout |
| | | from relation_length |
| | | group by flow_card_id, layer, films_id, first_length, second_Length, thickness |
| | | </select> |
| | | </mapper> |
| | |
| | | <module>TemperingGlassModule</module> |
| | | <module>UnLoadGlassModule</module> |
| | | <module>GlassStorageModule</module> |
| | | <module>howllowGlassModule</module> |
| | | </modules> |
| | | |
| | | <properties> |
| | |
| | | <module>common</module> |
| | | <module>moduleService</module> |
| | | <module>gateway</module> |
| | | <module>mesHub</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |