wangfei
2024-09-09 26229b3779579ca0d413fa75b69e32795a5cfb30
Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
20个文件已修改
15个文件已添加
1111 ■■■■■ 已修改文件
UI-Project/config.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/utils/constants.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/AsyncTaskExecutorConfig.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/entity/SysDictData.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/entity/SysDictType.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/mapper/SysDictDataMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/mapper/SysDictTypeMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/SysDictDataService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/SysDictTypeService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/impl/SysDictDataServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/impl/SysDictTypeServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageCageDetails.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageDetailsService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageDetailsServiceImpl.java 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/TemperingTask.java 108 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/BarcodeReadThread.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownLoadCacheGlassTask.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/config.js
@@ -1,10 +1,10 @@
export default {
 serverUrl: "10.153.19.150:88/api",
//  serverUrl: "10.153.19.150:88/api",
//  serverUrl: "192.168.1.199:88/api",
//  serverUrl: "127.0.0.1:88/api",
  serverUrl2: "10.153.19.150:88"
 serverUrl: "127.0.0.1:88/api",
  // serverUrl2: "10.153.19.150:88"
  // serverUrl2: "192.168.1.199:88"
    // serverUrl2: "127.0.0.1:88"
    serverUrl2: "127.0.0.1:88"
  //serverUrl:"res.abeim.cn"
}
UI-Project/src/utils/constants.js
@@ -1,4 +1,4 @@
//  export const WebSocketHost = "192.168.1.199";
export const WebSocketHost = "10.153.19.150";
// export const WebSocketHost = "127.0.0.1";
// export const WebSocketHost = "10.153.19.150";
export const WebSocketHost = "127.0.0.1";
export const host = "88";
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -17,10 +17,14 @@
const printLoading = ref(true)
const fullFlowCard = ref('')
const autoPrint = ref(false)
const takeGlass = ref([])
const scanGlass = ref([])
const dialogFormVisiblea = ref(false)
const dialogFormVisiblea2 = ref(false)
const dialogFormVisibleaDownGlass = ref(false)
const dialogFormVisibleaDownGlasss = ref(false)
// 数据
const loading = ref(false);
// 弹框显示控制
@@ -208,6 +212,12 @@
  }
  if (data.autoPrint != null) {
    autoPrint.value = data.autoPrint[0];
  }
  if (data.takeGlass != null) {
    takeGlass.value = data.takeGlass[0];
  }
  if (data.scanGlass != null) {
    scanGlass.value = data.scanGlass[0];
  }
  //自动打印
@@ -417,8 +427,11 @@
    <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 10px;" id="searchButton" type="primary"
               @click="dialogFormVisibleaDownGlass = true">落架详情
    </el-button>
    <el-switch style="margin-top: 10px;margin-left: 15px;margin-bottom: 10px;" v-model="autoPrint" class="mb-2" :inactive-text="$t('自动打印')"
               @change="handleChange"/>
    <el-button style="margin-top: 10px;margin-left: 10px;margin-bottom: 10px;" id="searchButton" type="primary"
      @click="dialogFormVisibleaDownGlasss = true">人工下片
    </el-button>
    <el-switch style="margin-top: 10px;margin-left: 15px;margin-bottom: 10px;" v-model="autoPrint" class="mb-2"
      :inactive-text="$t('自动打印')" @change="handleChange" />
    <el-card style="flex: 1;" v-loading="loading">
      <el-card style="flex: 1;margin-left: 4px;margin-top: 1px;" v-loading="loading">
        <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
@@ -457,8 +470,7 @@
          </el-table>
        </div>
        <el-dialog v-model="dialogFormVisibleaDownGlass" top="2vh" width="97%"
                   :title="$t('searchOrder.cageinformation')">
        <el-dialog v-model="dialogFormVisibleaDownGlass" top="2vh" width="97%" :title="$t('落架信息')">
          <el-select v-model="selectValuesa[0]" filterable :placeholder="$t('请选择工位')" clearable>
            <el-option label="全部" value="0"></el-option>
            <el-option label="1" value="1"></el-option>
@@ -476,8 +488,8 @@
          </el-select>
          <span class="demonstration">时间段</span>
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" value-format = "YYYY-MM-DD hh:mm:ss"
                          end-placeholder="结束日期">
          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期"
            value-format="YYYY-MM-DD hh:mm:ss" end-placeholder="结束日期">
          </el-date-picker>
          <el-button type="primary" style="margin-left: 10px;" @click="selectDownGlassData()">{{
@@ -496,10 +508,32 @@
            <el-table-column prop="Filmsid" align="center" :label="$t('膜系')" min-width="120"/>
            <el-table-column prop="thickness" align="center" label="厚度" min-width="120"/>
            <el-table-column prop="glassId" align="center" :label="$t('玻璃id')" min-width="120"/>
          </el-table>
        </el-dialog>
        <el-dialog v-model="dialogFormVisibleaDownGlasss" top="2vh" width="97%" :title="$t('人工下片信息')">
          <div style="display:flex;justify-content: space-around;">
            <el-card style="display: flex; justify-content: center; align-items: center; width:800px; height: 800px;">
              <div
                :style="{ width: takeGlass.width + 'px', height: takeGlass.height + 'px', backgroundColor: '#e1f3d8', transform: 'scale(' + 800 / (takeGlass.width > takeGlass.height ? takeGlass.width : takeGlass.height) + ')' }">
                <div style="font-size: 50px; text-align: center;">
                  <div>{{ takeGlass.flowCardId }}</div>
                  <div>{{ takeGlass.width }}</div>
                  <div>{{ takeGlass.height }}</div>
                </div>
              </div>
            </el-card>
            <el-card style="display: flex; justify-content: center; align-items: center; width: 800px; height: 800px;">
              <div
                :style="{ width: scanGlass.width + 'px', height: scanGlass.height + 'px', backgroundColor: '#e1f3d8', transform: 'scale(' + 800 / (scanGlass.width > scanGlass.height ? scanGlass.width : scanGlass.height) + ')' }">
                <div style="font-size: 50px; text-align: center;">
                  <div>{{ scanGlass.flowCardId }}</div>
                  <div>{{ scanGlass.width }}</div>
                  <div>{{ scanGlass.height }}</div>
                </div>
              </div>
            </el-card>
          </div>
        </el-dialog>
      </el-card>
      <!-- workstationId: '1',
    workstationId: '1005',
@@ -561,8 +595,7 @@
                style="width: 100%;height: 100%"/>
  </el-dialog>
  <el-dialog id="sizePrintCalrd1" v-model="dialogTableVisible1" destroy-on-close >
    <print-label id="printFlowCard" :printFlowCardId="printFlowCardId" :printLayer="printLayer"
                style=""/>
    <print-label id="printFlowCard" :printFlowCardId="printFlowCardId" :printLayer="printLayer" style="" />
  </el-dialog>
</template>
hangzhoumesParent/common/servicebase/pom.xml
@@ -22,6 +22,12 @@
            <artifactId>mssql-jdbc</artifactId>
            <version>6.4.0.jre8</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.8.1</version>
        </dependency>
    </dependencies>
</project>
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/AsyncTaskExecutorConfig.java
New file
@@ -0,0 +1,51 @@
package com.mes.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.ThreadPoolExecutor;
/**
 * <p> @Title AsyncTaskExecutorConfig
 * <p> @Description 异步线程池配置
 *
 * @author ACGkaka
 * @date 2023/4/24 19:48
 */
@EnableAsync
@Configuration
public class AsyncTaskExecutorConfig {
    /**
     * 核心线程数(线程池维护线程的最小数量)
     */
    private int corePoolSize = 10;
    /**
     * 最大线程数(线程池维护线程的最大数量)
     */
    private int maxPoolSize = 200;
    /**
     * 队列最大长度
     */
    private int queueCapacity = 10;
    @Bean
    public TaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(corePoolSize);
        executor.setMaxPoolSize(maxPoolSize);
        executor.setQueueCapacity(queueCapacity);
        executor.setThreadNamePrefix("MyExecutor-");
        // for passing in request scope context 转换请求范围的上下文
//        executor.setTaskDecorator(new ContextCopyingDecorator());
        // rejection-policy:当pool已经达到max size的时候,如何处理新任务
        // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
        executor.setWaitForTasksToCompleteOnShutdown(true);
        executor.initialize();
        return executor;
    }
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java
@@ -171,4 +171,13 @@
    public static final Integer SLOT_ON = 1;
    public static final Integer SLOT_OFF = 0;
    /**
     * 下片任务玻璃状态
     * 生成任务0
     * 出片任务2
     */
    public static final Integer UNLOAD_GLASS_CREATE = 0;
    public static final Integer UNLOAD_GLASS_OUT = 1;
    public static final Integer UNLOAD_GLASS_DOWN = 2;
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
@@ -144,7 +144,7 @@
    /**
     * 是否合并
     */
    private Integer merge;
    private Integer combine;
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -43,7 +43,7 @@
                    .select("b.process_id,t.glass_type,b.o_width,b.o_height,t.glass_thickness,b.order_sort,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,c.x_axis,c.y_axis,b.project_no,b.glass_id,c.rotate_angle,d.merge")
                    .leftJoin("optimize_detail b on t.project_no=b.project_no")
                    .leftJoin("optimize_heat_detail c on c.project_no=t.project_no and b.heat_layout_id=c.layout_id and b.heat_layout_sort=c.sort")
                    .leftJoin("flow_card d on d.process_id=b.process_id and d.layers_number=b.layer")
                    .leftJoin("flow_card d on d.process_id=b.process_id and d.technology_number=b.layer and  d.order_number=b.order_sort ")
                    //.eq("t.state",100)
                    .eq("t.project_no", engineeringId));
        }
@@ -73,7 +73,7 @@
                glassInfo.setYCoordinate(map.getYAxis());
                glassInfo.setAngle(map.getRotateAngle());
                glassInfo.setGlassId(map.getGlassId());
                glassInfo.setMerge(map.getMerge());
                glassInfo.setCombine(map.getMerge());
                // 将映射后的对象添加到结果列表中
                resultList.add(glassInfo);
            }
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/entity/SysDictData.java
New file
@@ -0,0 +1,48 @@
package com.mes.sysdict.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
 * <p>
 *
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class SysDictData implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "dict_id", type = IdType.AUTO)
    private Long dictId;
    private Integer dictSort;
    private String dictLabel;
    private String dictValue;
    private String dictType;
    private String dictTypeValue;
    private String state;
    private String description;
    private Date createTime;
    @TableLogic
    private String deleted;
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/entity/SysDictType.java
New file
@@ -0,0 +1,43 @@
package com.mes.sysdict.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * <p>
 *
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class SysDictType implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "dict_id", type = IdType.AUTO)
    private Long dictId;
    private String dictName;
    private String dictType;
    private String state;
    private String description;
    private LocalDateTime createTime;
    @TableLogic
    private String deleted;
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/mapper/SysDictDataMapper.java
New file
@@ -0,0 +1,16 @@
package com.mes.sysdict.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.sysdict.entity.SysDictData;
/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
public interface SysDictDataMapper extends BaseMapper<SysDictData> {
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/mapper/SysDictTypeMapper.java
New file
@@ -0,0 +1,16 @@
package com.mes.sysdict.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.sysdict.entity.SysDictType;
/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
public interface SysDictTypeMapper extends BaseMapper<SysDictType> {
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/SysDictDataService.java
New file
@@ -0,0 +1,16 @@
package com.mes.sysdict.service;
import com.github.yulichang.base.MPJBaseService;
import com.mes.sysdict.entity.SysDictData;
/**
 * <p>
 * 服务类
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
public interface SysDictDataService extends MPJBaseService<SysDictData> {
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/SysDictTypeService.java
New file
@@ -0,0 +1,16 @@
package com.mes.sysdict.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.sysdict.entity.SysDictType;
/**
 * <p>
 * 服务类
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
public interface SysDictTypeService extends IService<SysDictType> {
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/impl/SysDictDataServiceImpl.java
New file
@@ -0,0 +1,20 @@
package com.mes.sysdict.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.sysdict.entity.SysDictData;
import com.mes.sysdict.mapper.SysDictDataMapper;
import com.mes.sysdict.service.SysDictDataService;
import org.springframework.stereotype.Service;
/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysdict/service/impl/SysDictTypeServiceImpl.java
New file
@@ -0,0 +1,20 @@
package com.mes.sysdict.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.sysdict.entity.SysDictType;
import com.mes.sysdict.mapper.SysDictTypeMapper;
import com.mes.sysdict.service.SysDictTypeService;
import org.springframework.stereotype.Service;
/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wu
 * @since 2024-09-05
 */
@Service
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements SysDictTypeService {
}
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageCageDetails.java
New file
@@ -0,0 +1,104 @@
package com.mes.bigstorage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mes.base.entity.BigStorageCageBaseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
 * <p>
 *
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
@Api(description = "大理片笼详情")
@Data
@EqualsAndHashCode(callSuper = false)
public class BigStorageCageDetails extends BigStorageCageBaseInfo implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 大理片笼详情表id
     */
    @ApiModelProperty(value = "大理片笼详情表id", position = 2)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 设备id
     */
    @ApiModelProperty(value = "设备id", position = 3)
    private Integer deviceId;
    /**
     * 小片在格内的顺序
     */
    @ApiModelProperty(value = "小片在格内的顺序", position = 6)
    private Integer sequence;
    /**
     * 流程卡号
     */
    @ApiModelProperty(value = "流程卡号", position = 7)
    private String flowCardId;
    /**
     * 玻璃类型
     */
    @ApiModelProperty(value = "玻璃类型", position = 8)
    private Integer glassType;
    /**
     * 厚度
     */
    @ApiModelProperty(value = "厚度", position = 11)
    private double thickness;
    /**
     * 钢化版图id
     */
    @ApiModelProperty(value = "钢化版图id", position = 12)
    private Integer temperingLayoutId;
    /**
     * 钢化版图片序
     */
    @ApiModelProperty(value = "钢化版图片序", position = 13)
    private Integer temperingFeedSequence;
    /**
     * 状态
     */
    @ApiModelProperty(value = "状态", position = 14)
    private Integer state;
    /**
     * 玻璃间隙
     */
    @ApiModelProperty(value = "玻璃间隙", position = 15)
    private Integer gap;
    /**
     * 工程号
     */
    @ApiModelProperty(value = "工程号", position = 16)
    private String engineerId;
    /**
     * 工程号
     */
    @ApiModelProperty(value = "层", position = 17)
    private int layer;
}
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
New file
@@ -0,0 +1,21 @@
package com.mes.bigstorage.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
public interface BigStorageCageDetailsMapper extends MPJBaseMapper<BigStorageCageDetails> {
}
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
New file
@@ -0,0 +1,21 @@
package com.mes.bigstorage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.glassinfo.entity.GlassInfo;
import java.util.List;
import java.util.Map;
/**
 * <p>
 * 服务类
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
public interface BigStorageCageDetailsService extends IService<BigStorageCageDetails> {
}
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
New file
@@ -0,0 +1,25 @@
package com.mes.bigstorage.service.impl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
@Slf4j
@Service
public class BigStorageCageDetailsServiceImpl extends MPJBaseServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService {
}
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageDetailsService.java
@@ -17,6 +17,8 @@
 */
public interface EdgStorageCageDetailsService extends MPJBaseService<EdgStorageCageDetails> {
//    boolean identWorn(Map<String, Object> arguments);
    /**
     * 获取 切割当前版图
     * @return
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageDetailsServiceImpl.java
@@ -8,8 +8,11 @@
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.common.config.Const;
import com.mes.damage.entity.Damage;
import com.mes.damage.mapper.DamageMapper;
import com.mes.damage.service.DamageService;
import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
import com.mes.edgglasstask.entity.request.IdentWornRequest;
@@ -19,6 +22,8 @@
import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper;
import com.mes.edgstoragecage.mapper.EdgStorageCageMapper;
import com.mes.edgstoragecage.service.EdgStorageCageDetailsService;
import com.mes.engineering.entity.Engineering;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.mapper.GlassInfoMapper;
import com.mes.pp.entity.OptimizeDetail;
import com.mes.pp.entity.OptimizeLayout;
@@ -65,11 +70,51 @@
    TaskCacheService taskCacheService;
    @Autowired
    DamageMapper damageMapper;
    @Autowired
    DamageService damageService;
    @Autowired
    EdgGlassTaskInfoService edgGlassTaskInfoService;
    @Autowired
    BigStorageCageDetailsService bigStorageCageDetailsService;
//
//    @Override
//    public boolean identWorn(Map<String, Object> arguments) {
//        String glassId=arguments.get("glassId").toString();
//        int state=arguments.get("state").toString().isEmpty()?0:Integer.parseInt(arguments.get("state").toString());
//        int line=arguments.get("line").toString().isEmpty()?0:Integer.parseInt(arguments.get("line").toString());
//        String workingProcedure=arguments.get("workingProcedure").toString();
//        if(state==0||line==0||workingProcedure==null||glassId==null||glassId.isEmpty()){
//            log.info("前端传递数据不全:{}",arguments);
//            return false;
//        }
//        List<GlassInfo> GlassInfos = glassInfoMapper.selectList(new MPJLambdaQueryWrapper<GlassInfo>()
//                .selectAll(GlassInfo.class)
//                .eq(GlassInfo::getGlassId, glassId));
//        if (GlassInfos.size() == 1) {
//            Damage damage =new Damage();
//            damage.setGlassId(glassId);
//            damage.setLine(line);
//            damage.setWorkingProcedure(workingProcedure);
//            damage.setRemark("");
//            damage.setStatus(state);//8破损,9拿走
//            damageService.insertDamage(damage);
//        }else{
//            return false;
//        }
//        List<EdgStorageCageDetails> edgStorageCageDetails = baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>()
//                .selectAll(EdgStorageCageDetails.class)
//                .eq(EdgStorageCageDetails::getGlassId, glassId));
//        if (edgStorageCageDetails.size() == 1) {
//            EdgStorageCageDetails item = edgStorageCageDetails.get(0);
//            item.setState(state);
//            baseMapper.update(item, new MPJLambdaWrapper<EdgStorageCageDetails>().selectAll(EdgStorageCageDetails.class).eq(EdgStorageCageDetails::getGlassId, glassId));
//        }
//        return true;
//    }
    /**
     * 获取 切割当前版图
     *
@@ -77,10 +122,14 @@
     */
    @Override
    public List<Map<String, Object>> selectCutTerritory() {
        List<UpPattenUsage> upPattenUsage = upPattenUsageMapper.selectList(new MPJLambdaWrapper<UpPattenUsage>()
        List<UpPattenUsage> upPattenUsage=upPattenUsageMapper.selectJoinList(UpPattenUsage.class, new MPJLambdaWrapper<UpPattenUsage>()
                .selectAll(UpPattenUsage.class)
                .innerJoin(Engineering.class, on -> on
                        .eq(Engineering::getEngineerId, UpPattenUsage::getEngineeringId))
                .eq(Engineering::getState,1)
                .orderByDesc(UpPattenUsage::getState)
                .orderByDesc(UpPattenUsage::getId));
                .orderByDesc(UpPattenUsage::getId)
        );
        if (!upPattenUsage.isEmpty()) {
            UpPattenUsage upPattenUsage1 = upPattenUsage.get(0);
            List<Map<String, Object>> cutTerritorys = optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class)
@@ -93,29 +142,34 @@
                    .eq(OptimizeDetail::getProjectNo, upPattenUsage1.getEngineeringId())
                    .eq(OptimizeDetail::getStockId, upPattenUsage1.getLayoutSequence())
            );
            List<Map<String, Object>> ResultcutTerritorys = new ArrayList<>();
            for (Map<String, Object> cutTerritory : cutTerritorys) {
                EdgStorageCageDetails edgStorageCageDetails = baseMapper.selectOne(new MPJLambdaQueryWrapper<EdgStorageCageDetails>()
            Map<String, EdgStorageCageDetails> edgMaps=baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>()
                        .selectAll(EdgStorageCageDetails.class)
                        .eq(EdgStorageCageDetails::getGlassId, cutTerritory.get("glass_id"))
                        .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN));
                    .eq(EdgStorageCageDetails::getEngineerId,upPattenUsage1.getEngineeringId())
                    .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)
            ).stream().collect(Collectors.toMap(EdgStorageCageDetails::getGlassId,EdgStorageCageDetails->EdgStorageCageDetails));
            Map<String, Damage> damageMaps=damageMapper.selectList(new MPJLambdaQueryWrapper<Damage>()
                    .selectAll(Damage.class)
                    .eq(Damage::getEngineerId,upPattenUsage1.getEngineeringId())
            ).stream().collect(Collectors.toMap(Damage::getGlassId,Damage->Damage,(V1,V2)->V2));
            List<Map<String, Object>> resultCutTerritory=new ArrayList<>();
            for (Map<String, Object> cutTerritory : cutTerritorys) {
//                log.info("内容:{}-------{}",cutTerritory,edgStorageCageDetails);
                if (edgStorageCageDetails != null) {
                    cutTerritory.put("glass_state", edgStorageCageDetails.getState());
                if(cutTerritory.get("glass_id")==null||"".equals(cutTerritory.get("glass_id"))){
                    log.info("优化数据中glassId存在空值-----内容:{}",cutTerritorys);
                    return new ArrayList<>();
                }else if(edgMaps.get(cutTerritory.get("glass_id"))!=null){
                    cutTerritory.put("glass_state",edgMaps.get(cutTerritory.get("glass_id")).getState());
                }else if(damageMaps.get(cutTerritory.get("glass_id"))!=null){
                    //log.info("玻璃已破损/拿走-----内容:{}",damageMaps.get(item.get("glass_id")));
                    cutTerritory.put("glass_state",damageMaps.get(cutTerritory.get("glass_id")).getStatus());
                } else {
                    cutTerritory.put("glass_state", 0);
                }
                ResultcutTerritorys.add(cutTerritory);
                resultCutTerritory.add(cutTerritory);
            }
            return ResultcutTerritorys;
//            Sql版本
//            return optimizeDetailMapper.selectJoinMaps(new MPJQueryWrapper<OptimizeDetail>().selectAll(OptimizeDetail.class)
//                    .select("ol.width as olwidth","ol.height as olheight")
//                    .leftJoin("optimize_layout ol on t.project_no=ol.project_no and t.stock_id=ol.stock_id")
//                    .eq("t.project_no", upPattenUsage1.getEngineeringId())
//                    .eq("t.stock_id",upPattenUsage1.getLayoutSequence())
//            );
            return resultCutTerritory;
        }
        return null;
    }
@@ -128,10 +182,17 @@
     */
    @Override
    public List<List<Map<String, Object>>> selectCurrentCutTerritory(String current) {
        //大理片笼进过的玻璃
        Map<String, BigStorageCageDetails> mapBigCage=bigStorageCageDetailsService.list(
                new LambdaQueryWrapper<BigStorageCageDetails>()
                        .eq(BigStorageCageDetails::getEngineerId,current)
                        .gt(BigStorageCageDetails::getState,Const.GLASS_STATE_NEW)
        ).stream().collect(Collectors.toMap(BigStorageCageDetails::getGlassId,BigStorageCageDetails->BigStorageCageDetails,(V1,V2)->V2));;
        //结果
        List<Map<String, Object>> ResultcutTerritorys = new ArrayList<>();
        List<Map<String, Object>> resultCutTerritory=new ArrayList<>();
        //此工程的所有优化数据
        List<Map<String, Object>> cutTerritorys = optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class)
        List<Map<String, Object>> cutTerritory=optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class)
                .selectAll(OptimizeDetail.class)
                .selectAs(OptimizeLayout::getWidth, "olWidth")
                .selectAs(OptimizeLayout::getHeight, "olHeight")
@@ -145,28 +206,35 @@
                .selectAll(EdgStorageCageDetails.class)
                .eq(EdgStorageCageDetails::getEngineerId, current)
                .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)
        ).stream().collect(Collectors.toMap(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails -> EdgStorageCageDetails));
        for (Map<String, Object> cutTerritory : cutTerritorys) {
        ).stream().collect(Collectors.toMap(EdgStorageCageDetails::getGlassId,EdgStorageCageDetails->EdgStorageCageDetails,(V1,V2)->V2));
        Map<String, Damage> damageMaps=damageMapper.selectList(new MPJLambdaQueryWrapper<Damage>()
                .selectAll(Damage.class)
                .eq(Damage::getEngineerId,current)
        ).stream().collect(Collectors.toMap(Damage::getGlassId,Damage->Damage,(V1,V2)->V2));
        for (Map<String, Object> item : cutTerritory) {
//                log.info("内容:{}-------{}",cutTerritory,edgStorageCageDetails);
            if (cutTerritory.get("glass_id") == null || "".equals(cutTerritory.get("glass_id"))) {
                log.info("优化数据中glassId存在空值-----内容:{}", cutTerritorys);
            if(item.get("glass_id")==null||"".equals(item.get("glass_id"))){
                log.info("优化数据中glassId存在空值-----内容:{}",cutTerritory);
                return new ArrayList<>();
            } else if (edgMaps.get(cutTerritory.get("glass_id")) != null) {
                cutTerritory.put("glass_state", edgMaps.get(cutTerritory.get("glass_id")).getState());
            }
            if(damageMaps.get(item.get("glass_id"))!=null){
                //log.info("玻璃已破损/拿走-----内容:{}",damageMaps.get(item.get("glass_id")));
                item.put("glass_state",damageMaps.get(item.get("glass_id")).getStatus());
            }else if(mapBigCage.get(item.get("glass_id"))!=null){
                //进过大理片笼
                item.put("glass_state",98);
            }else if(edgMaps.get(item.get("glass_id"))!=null){
                item.put("glass_state",edgMaps.get(item.get("glass_id")).getState());
            } else {
                cutTerritory.put("glass_state", 0);
                item.put("glass_state",0);
            }
            ResultcutTerritorys.add(cutTerritory);
            resultCutTerritory.add(item);
        }
        Map<String, List<Map<String, Object>>> groupBy = ResultcutTerritorys.stream().collect(Collectors.groupingBy(item -> item.get("stock_id").toString()));
        Map<String, List<Map<String, Object>>> groupBy=resultCutTerritory.stream().collect(Collectors.groupingBy(item->item.get("stock_id").toString()));
//        List<List<Map<String, Object>>> Result=groupBy.values().stream().collect(Collectors.toList());
        return new ArrayList<>(groupBy.values());
//Sql版本
//        return optimizeDetailMapper.selectJoinMaps(new MPJQueryWrapper<OptimizeDetail>().selectAll(OptimizeDetail.class)
//                .select("ol.width as olwidth","ol.height as olheight")
//                .leftJoin("optimize_layout ol on t.project_no=ol.project_no and t.stock_id=ol.stock_id")
//                .eq("t.project_no",current)
//        );
    }
    /**
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -726,14 +726,6 @@
    public void CacheGlassTasks() {
        JSONObject jsonObject = new JSONObject();
        List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory();
//        List<Map<String, Object>> currentCutTerritorys=new ArrayList<>();
//        if(engineerId==null||engineerId.isEmpty()){
//            //识别摆片 当前版图数据
//            currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory();
//        }else{
//            //识别摆片 此engineerId 工程版图数据
//            currentCutTerritorys = edgStorageCageDetailsService.selectCurrentCutTerritory(engineerId);
//        }
        jsonObject.append("currentCutTerritory", currentCutTerritorys);
        //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys);
        //磨边信息
hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
@@ -6,6 +6,8 @@
    active: dev
  application:
    name: cacheGlass
  liquibase:
    enabled: false
mybatis-plus:
  mapper-locations: classpath*:mapper/*.xml
  configuration:
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -4,7 +4,6 @@
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.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -601,7 +600,11 @@
                if (glassCount < inCarMaxSize) {
                    addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst, heightFirst);
                } else {
                    if (glassCount < inCarMaxSize + 1) {
                    addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst, heightFirst);
                    } else {
                        return Boolean.FALSE;
                    }
                }
            } else {
                flag = Boolean.FALSE;
@@ -612,12 +615,20 @@
            if (remainWidth >= widthFirst) {
                if (remainWidth - widthFirst - glassGap >= widthSecond) {
                    if (glassCount < inCarMaxSize) {
                        addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst, heightSecond);
                        addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst, heightFirst);
                    } else {
                        addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst, heightSecond);
                        if (glassCount < inCarMaxSize + 1) {
                            addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst, heightFirst);
                        } else {
                            return Boolean.FALSE;
                        }
                    }
                } else {
                    addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst, heightSecond);
                    if (glassCount < inCarMaxSize + 1) {
                        addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst, heightFirst);
                    } else {
                        return Boolean.FALSE;
                    }
                }
            } else {
                flag = Boolean.FALSE;
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
@@ -6,6 +6,8 @@
    active: cz
  application:
    name: cacheVerticalGlass
  liquibase:
    enabled: false
mybatis-plus:
  mapper-locations: classpath*:mapper/*.xml
  configuration:
hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml
@@ -6,6 +6,8 @@
    active: dev
  application:
    name: glassStorage
  liquibase:
    enabled: false
mybatis-plus:
hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
@@ -5,6 +5,8 @@
    active: dev
  application:
    name: loadGlass
  liquibase:
    enabled: false
mybatis-plus:
  mapper-locations: classpath*:mapper/*.xml
  configuration:
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/TemperingTask.java
@@ -8,15 +8,21 @@
import com.mes.damage.entity.Damage;
import com.mes.damage.service.DamageService;
import com.mes.device.PlcParameterObject;
import com.mes.sysdict.entity.SysDictData;
import com.mes.sysdict.service.SysDictDataService;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.service.TemperingGlassInfoService;
import com.mes.temperingrecord.entity.TemperingRecord;
import com.mes.temperingrecord.service.TemperingRecordService;
import com.mes.tools.S7control;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
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.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -31,7 +37,7 @@
public class TemperingTask {
    @Autowired
    private TemperingRecordService temporalRecordService;
    private TemperingRecordService temperingRecordService;
    @Autowired
    private TemperingGlassInfoService temporaryGlassInfoService;
@@ -39,53 +45,105 @@
    @Autowired
    private DamageService damageService;
    @Autowired
    private SysDictDataService sysDictDataService;
    private static final String ALONE_STATE = "0";
    @Value("${mes.width}")
    private Integer temperingWidth;
    @Value("${mes.height}")
    private Integer temperingHeight;
    @Scheduled(fixedDelay = 1000)
    public void temperingGlassBefore() {
        Date startDate = new Date();
        log.info("本次任务开始执行时间:{}", startDate);
        PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
        S7control plcControl = S7object.getinstance().plccontrol;
        String state = plcParameterObject.getPlcParameter("state").getValue();
//        当前连线状态为
        if (ALONE_STATE.equals(state)) {
            log.info("当前钢化炉连线模式为:{},不执行该任务", state);
            log.info("当前钢化炉连线模式为:{},(0:手动;1:连线),不执行该任务", state);
            return;
        }
        //将确认字置为0
        S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("confirmationWord").getAddress(), 0);
        //todo:获取钢化版图中状态为2的(进炉完成的玻璃信息)  且不存在钢化记录表内的
        List<Object> temperRecordIdListObj = temporalRecordService.listObjs(new QueryWrapper<TemperingRecord>().select("distinct tempering_layout_id"));
        List<String> temperRecordIdList = temperRecordIdListObj.stream().map(String::valueOf).collect(Collectors.toList());
        if (CollectionUtils.isEmpty(temperRecordIdList)) {
        plcControl.writeWord(plcParameterObject.getPlcParameter("confirmationWord").getAddress(), 0);
        //可能有几炉玻璃同时在钢,需要获取钢化小片表中的数据信息状态为2(旋转台玻璃已送出未钢化,正在钢化)
        List<TemperingGlassInfo> temperingGlassInfoList = temporaryGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>()
                .eq(TemperingGlassInfo::getState, Const.TEMPERING_START));
        if (CollectionUtils.isEmpty(temperingGlassInfoList)) {
            log.info("当前系统没有需要钢化的玻璃信息");
            return;
        }
        List<TemperingGlassInfo> list = temporaryGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>()
                .eq(TemperingGlassInfo::getState, Const.TEMPERING_START).notIn(TemperingGlassInfo::getTemperingLayoutId, temperRecordIdList));
        if (CollectionUtils.isEmpty(list)) {
            log.info("当前系统没有需要钢化的玻璃信息");
            return;
        }
        List<Integer> temperingLayoutIdList = list.stream().map(TemperingGlassInfo::getTemperingLayoutId).distinct().collect(Collectors.toList());
        if (CollectionUtils.isNotEmpty(temperRecordIdList)) {
            temperingLayoutIdList.removeAll(temperRecordIdList);
        }
        if (CollectionUtils.isEmpty(temperingLayoutIdList)) {
            log.info("当前玻璃有正在钢化的任务");
        }
//        获取钢化下片表状态为2的玻璃信息
        TemperingGlassInfo maxGlassInfo = temperingGlassInfoList.stream().max(Comparator.comparingLong(TemperingGlassInfo::getId)).get();
        //拿到工程id及炉号
//        List<EngineerTemperingDTO> engineerTemperingList = temperingGlassInfoList.stream().map(e -> {
//            EngineerTemperingDTO engineerTemperingDTO = new EngineerTemperingDTO();
//            BeanUtils.copyProperties(e, engineerTemperingDTO);
//            return engineerTemperingDTO;
//        }).distinct().collect(Collectors.toList());
        //将正在钢化的炉号过滤掉,仅获取待钢化的玻璃
//        List<TemperingRecord> temperingRecords = temperingRecordService.list(new LambdaQueryWrapper<TemperingRecord>().and(i -> i.isNull(TemperingRecord::getCoolEnergy).or().eq(TemperingRecord::getCoolEnergy, "")));
//        List<EngineerTemperingDTO> temperingList = new ArrayList<>();
//        if (CollectionUtils.isNotEmpty(temperingRecords)) {
//            temperingList = temperingRecords.stream().map(e -> {
//                EngineerTemperingDTO engineerTemperingDTO = new EngineerTemperingDTO();
//                BeanUtils.copyProperties(e, engineerTemperingDTO);
//                return engineerTemperingDTO;
//            }).collect(Collectors.toList());
//        }
//        engineerTemperingList.removeAll(temperingList);
//        if (CollectionUtils.isEmpty(engineerTemperingList)) {
//            log.info("没有待钢化的任务,结束");
//            return;
//        }
//        if (engineerTemperingList.size() > 1) {
//            log.info("存在多炉待钢化的任务,请检查现场是否有异常数据未处理");
//            return;
//        }
//        EngineerTemperingDTO temperingDTO = engineerTemperingList.get(0);
        //获取待钢化的所有玻璃信息
        List<TemperingGlassInfo> temperingGlassList = temperingGlassInfoList.stream()
                .filter(e -> e.getEngineerId().equals(maxGlassInfo.getEngineerId())
                        && e.getTemperingLayoutId().equals(maxGlassInfo.getTemperingLayoutId()))
                .sorted(Comparator.comparing(TemperingGlassInfo::getTemperingFeedSequence)).collect(Collectors.toList());
        //按照膜系获取玻璃材质
        SysDictData glassTypeSysDictData = sysDictDataService.getOne(new QueryWrapper<SysDictData>()
                .eq(StringUtils.isNotBlank(temperingGlassList.get(0).getFilmsid()), "dict_label", temperingGlassList.get(0).getFilmsid()));
        double sumArea = temperingGlassList.stream().mapToDouble(e -> e.getWidth() * e.getHeight()).sum();
        double maxArea = temperingGlassList.stream().mapToDouble(e -> e.getWidth() * e.getHeight()).max().orElse(0.0);
        double minArea = temperingGlassList.stream().mapToDouble(e -> e.getWidth() * e.getHeight()).min().orElse(0.0);
        double areaDifference = (10000 * (maxArea - minArea) / maxArea);
        double loadingRate = (int) (10000 * sumArea / (temperingHeight * temperingWidth));
        TemperingRecord temperingRecord = new TemperingRecord();
        temperingRecord.setEngineerId(maxGlassInfo.getEngineerId());
        temperingRecord.setTemperingLayoutId(maxGlassInfo.getTemperingLayoutId());
        temperingRecord.setGlassType(Integer.parseInt(glassTypeSysDictData.getDictTypeValue()));
        temperingRecord.setTemperingType(1);//全钢
        temperingRecord.setThickness(temperingGlassList.get(0).getThickness());
        temperingRecord.setAreaDifference(areaDifference);
        temperingRecord.setLoadingRate(loadingRate);
        temperingRecord.setState(Const.GLASS_STATE_NEW);
        //如果出现同一炉重读被处理,主键直接异常处理,不会发给plc钢化信息
        temperingRecordService.save(temperingRecord);
//      向plc发送钢化信息
        plcControl.writeWord(plcParameterObject.getPlcParameter("temperingLayoutId").getAddress(), maxGlassInfo.getTemperingLayoutId());
        plcControl.writeWord(plcParameterObject.getPlcParameter("filmsid").getAddress(), Integer.parseInt(glassTypeSysDictData.getDictTypeValue()));
        plcControl.writeWord(plcParameterObject.getPlcParameter("temperingType").getAddress(), 1);
        plcControl.writeWord(plcParameterObject.getPlcParameter("thickness").getAddress(), (int) (temperingGlassList.get(0).getThickness() * 10));
        plcControl.writeWord(plcParameterObject.getPlcParameter("areaDifference").getAddress(), (int) areaDifference);
        plcControl.writeWord(plcParameterObject.getPlcParameter("loadingRate").getAddress(), (int) loadingRate);
        //完成任务将确认字置为1
        S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("confirmationWord").getAddress(), 1);
        plcControl.writeWord(plcParameterObject.getPlcParameter("confirmationWord").getAddress(), 1);
        Date endDate = new Date();
        log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime());
    }
    @Scheduled(fixedDelay = 1000)
    public void temperingGlassAfter() {
        //暂不处理
    }
    @Scheduled(fixedDelay = 1000)
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
@@ -5,7 +5,13 @@
    active: dev
  application:
    name: temperingGlass
  liquibase:
    enabled: true
    change-log: classpath:changelog/changelog.sql
mybatis-plus:
  mapper-locations: classpath*:mapper/*.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mes:
  width: 2800
  height: 5000
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql
New file
@@ -0,0 +1,156 @@
--liquibase formatted sql
--changeset zsh:20240904001
--preconditions onFail:CONTINUE onError:CONTINUE
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_type';
CREATE TABLE sys_dict_type
(
    dict_id     BIGINT AUTO_INCREMENT PRIMARY KEY,
    dict_name   VARCHAR(32) NOT NULL,
    dict_type   VARCHAR(32) NOT NULL,
    state       CHAR(1)     NOT NULL DEFAULT TRUE,
    description VARCHAR(32),
    create_time TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
    deleted     char(1)              DEFAULT 0
);
--rollback DROP TABLE sys_dict_type;
--changeset zsh:20240904002
--preconditions onFail:CONTINUE onError:CONTINUE
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_data';
CREATE TABLE sys_dict_data
(
    dict_id         BIGINT AUTO_INCREMENT PRIMARY KEY,
    dict_sort       INT         NOT NULL,
    dict_label      VARCHAR(32) NOT NULL,
    dict_value      VARCHAR(32) NOT NULL,
    dict_type       VARCHAR(32) NOT NULL,
    dict_type_value varchar(32),
    state           CHAR(1)     NOT NULL DEFAULT TRUE,
    description     VARCHAR(32),
    create_time     TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
    deleted         char(1)              DEFAULT 0
);
--rollback DROP TABLE sys_dict_data;
--changeset zsh:20240904003
--preconditions onFail:CONTINUE onError:CONTINUE
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM sys_dict_type WHERE dict_type in ('clearGlass', 'silver', 'doubleSilver', 'thirdSilver', 'ultraClear', 'heatReflect');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('白玻', 'clearGlass', '1', '0', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('单银', 'silver', '1', '1', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('双银', 'doubleSilver', '1', '2', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('三银', 'thirdSilver', '1', '3', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('超白', 'ultraClear', '1', '4', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('热反射', 'heatReflect', '1', '5', '0');
--rollback DELETE FROM sys_dict_type WHERE dict_type in ('clearGlass', 'silver', 'doubleSilver', 'thirdSilver', 'ultraClear', 'heatReflect');
--changeset zsh:20240904004
--preconditions onFail:CONTINUE onError:CONTINUE
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM sys_dict_data WHERE dict_type in ('clearGlass', 'silver', 'doubleSilver', 'thirdSilver', 'ultraClear', 'heatReflect');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (1, '白玻', 'clearGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (2, '超白', 'ultraClear', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (3, '来料白玻', 'incomingClearGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (4, '欧州茶', 'europeTeaColor', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (5, '水晶灰', 'cristalGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (6, '灰玻', 'grayGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (7, '灰镀膜', 'grayCoating', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (8, '磨砂', 'frosted', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (9, '福特蓝', 'fordBlue', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (10, '福特蓝镀膜', 'fordBlueCoating', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (11, '蓝星灰', 'blueAstralGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (12, '蓝玻', 'blueGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (13, '超白长虹', 'ultraClearChanghong', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (14, '金晶灰', 'jinjinGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (15, '金晶灰茶', 'jinjinTeaGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (16, '镀膜', 'coatingFilm', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (17, '长虹', 'clearGlassChanghong', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (18, '阳光膜', 'solorControl', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (19, '高反底透', 'arGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (20, '高白', 'arClear', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (21, '黑玻', 'blackGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (22, '玉砂', 'emery', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (23, '超白磨砂', 'ultraClearFrosted', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (24, '金茶玻', 'goldenTea', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (25, '蓝灰镀膜', 'blueGraycoatingFilm', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (26, '单项透视', 'onePoint', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (27, '超白镀膜', 'ultraClearCoatingFilm', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (1, 'F绿', 'fGreen', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (2, 'F绿lowe', 'fGreenLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (3, 'F绿镀膜', 'fGreenCoating', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (4, 'Low-e', 'lowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (5, 'super52', 'super52', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (6, '中玻在线', 'zgOnlineGlass', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (7, '北玻60离线lowe', 'ng60OfflineLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (8, '南玻在线lowe', 'csgOnlineLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (9, '台玻81A', 'tg81a', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (10, '台玻lowe70', 'tgLowe70', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (11, '台玻LOWE78', 'tgLowe78', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (12, '河北金瑞lowe80', 'hbJinruiLowe80', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (13, '福特蓝lowe', 'fordBlueLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (14, '福莱特FXB60', 'flatFxb60', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (15, '福莱特lowe60', 'flatLowe60', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (16, '福莱特lowe70', 'flatLowe70', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (17, '福莱特lowe80', 'flatLowe80', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (18, '耀皮在线LOWE', 'sypOnlineLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (19, '超白Lowe', 'ultraClearLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (1, '双银lowe', 'doubleSilverLowe', '双银', '2', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (2, '超白双银Lowe', 'ultraDoubleSilverLowe', '双银', '2', '1', '1', '0');
--rollback DELETE FROM sys_dict_data WHERE dict_type in ('clearGlass', 'silver', 'doubleSilver', 'thirdSilver', 'ultraClear', 'heatReflect');
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/BarcodeReadThread.java
New file
@@ -0,0 +1,82 @@
package com.mes.job;
import com.mes.glassinfo.service.GlassInfoService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.Socket;
public class BarcodeReadThread extends Thread{
    public BarcodeReadThread(String ip,Integer port,Downpush downpush)
    {
        this.ip=ip;
        this.port=port;
        this.downpush=downpush;
    }
    private Socket socket;
    private String ip;
    private Integer port;
    private Downpush downpush;
    private  BufferedReader in;
    @SneakyThrows
    @Override
    public void run()
    {
        connectCheckin();//初次 循环尝试连接,直到连接成功
        while (this!=null)
        {
            try
            {
                in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                String response = in.readLine();
                if(response!=null)
                {
                    downpush.barcodeCheckin(response);
                }
            }
            catch (Exception exception)
            {
                //异常,重连
                connectCheckin();
            }
            finally {
                if(in!=null)
                {
                    in.close();
                }
            }
            Thread.sleep(100);
        }
    }
    @SneakyThrows
    private void connectCheckin()
    {
        while (this!=null)
        {
            try
            {
                socket=new Socket();
                socket.setSoTimeout(10000);
                socket.connect(new InetSocketAddress(ip,port));
                if(socket.isConnected())
                {
                    return;
                }
            }
            catch (Exception exception)
            {
            }
            Thread.sleep(1000);
        }
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownLoadCacheGlassTask.java
@@ -30,6 +30,7 @@
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -80,6 +81,7 @@
    @Scheduled(fixedDelay = 300)
    @Async
    public void plcHomeEdgTask() {
        PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
        String requestWord = plcParameterObject.getPlcParameter("requestWord").getValue();
@@ -129,6 +131,7 @@
    }
    @Scheduled(fixedDelay = 300)
    @Async
    public void plcShelfFull() {
        List<DownWorkstation> list = downGlassInfoService.queryWorkStationIsFull();
        if (CollectionUtils.isNotEmpty(list)) {
@@ -139,6 +142,7 @@
    }
    @Scheduled(fixedDelay = 1000)
    @Async
    public void dealDamageTask() {
        Date startDate = new Date();
        log.info("下片破损玻璃清除任务开始执行时间:{}", startDate);
@@ -183,6 +187,7 @@
     * 更新已绑定工位流程卡的破损/拿走的数量信息
     */
    @Scheduled(fixedDelay = 1000)
    @Async
    public void updateWorkStationOtherCount() {
        Date startDate = new Date();
        log.info("下片破更新损玻璃数量任务开始执行时间:{}", startDate);
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -22,15 +22,19 @@
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@Slf4j
@@ -47,6 +51,13 @@
    private DownGlassTaskService downGlassTaskService;
    @Autowired
    private GlassInfoService glassInfoService;
    private final ExecutorService scanCodeThreadPool = new ThreadPoolExecutor(
            10, // core pool size
            20, // maximum pool size
            60L, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>()
    );
    private final ExecutorService isRunThreadPool = Executors.newFixedThreadPool(5);
    @Value("${mes.scan.ip}")
    private String scanIp;
@@ -167,8 +178,8 @@
                new QueryWrapper<DownGlassTask>()
                        .select("Top 1 *")
                        .eq("end_cell", Const.G13_WORK_STATION)
                        .lt("task_status", Const.UNLOAD_GLASS_DOWN)
                        .orderByDesc("id")
        );
        jsonObject4.append("takeGlass", takeGlass);
@@ -185,6 +196,7 @@
    @Scheduled(fixedDelay = 1000)
    public void isRun() {
        isRunThreadPool.execute(() -> {
        JSONObject jsonObject = new JSONObject();
        //正在进行的任务
        List<DownWorkstation> downWorkstation = downWorkstationService.getoneDownWorkstations(1, 6);
@@ -201,16 +213,58 @@
                }
            }
        }
        });
    }
    @Async
    @Scheduled(fixedDelay = Long.MAX_VALUE)
    public void scanCodeTask() {
        JSONObject jsonObject = new JSONObject();
        log.info("扫描任务已启动");
        while (true) {
            try (Socket socket = new Socket(scanIp, scanPort);
                 BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
                // 接收服务器响应
                String response;
                while ((response = in.readLine()) != null) {
//                socket.setSoTimeout(1000);
                log.info("等待扫码中......");
                    String glassId = in.readLine();
                    log.info("扫描到的玻璃id:{}", glassId);
                    List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
                    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 {
                            jsonObject.append("scanGlass",glassInfo);
                            sendwServer.get(0).sendMessage(jsonObject.toString());
                        }
                    }
            } catch (Exception exception) {
                log.info("读取异常,原因为{}", exception.getMessage());
            }
        }
    }
    @Scheduled(fixedDelay = Long.MAX_VALUE)
    public void scanCodeTaskCopy()
    {
        log.info("扫描任务已启动");
        try {
            BarcodeReadThread brt=new BarcodeReadThread(scanIp,scanPort,this);
            brt.start();
        }catch (Exception exception) {
            log.info("扫描任务启动异常,原因为{}", exception.getMessage());
        }
    }
    //socket读取到消息后会调用这个函数
    public void barcodeCheckin(String response)
    {
        log.info("扫描到的玻璃id:{}", response);
                    List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("scanCode");
                    if (CollectionUtils.isNotEmpty(sendwServer)) {
                        //按照玻璃id获取玻璃信息返回给前端界面,具体需要哪些数据待确认
@@ -220,11 +274,6 @@
                            log.info("按照玻璃id:{},无法找到玻璃信息", response);
                        } else {
                            sendwServer.get(0).sendMessage(glassInfo.toString());
                        }
                    }
                }
            } catch (Exception exception) {
                log.info("读取异常,原因为{}", exception.getMessage());
            }
        }
    }
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
@@ -6,6 +6,13 @@
    active: dev
  application:
    name: unLoadGlass
  liquibase:
    enabled: false
  task:
    scheduling:
      pool:
        size: 10
      thread-name-prefix: task-unLoad
mybatis-plus:
@@ -22,5 +29,5 @@
  throughHeight: 2500
  threshold: 5      #下片的最大阈值
  scan:
    ip: 127.0.0.1
    ip: 169.254.171.199
    port: 5000