hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java
@@ -316,7 +316,7 @@ // 将 JSON 对象和数组添加到结果对象中 result.put("title", reportingWorkJson); result.put("detail", detailsJsonArray); result.put("type", 0); result.put("type", 1); result.put("userId", "admin"); result.put("userName", "admin"); result.put("qualityInsStatus", 0); hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java
@@ -58,7 +58,7 @@ if (flag && CollectionUtil.isNotEmpty(emptyList)) { return emptyList.get(0); } if (CollectionUtil.isEmpty(emptyList) || emptyList.size() == 1) { if (CollectionUtil.isEmpty(emptyList)) { return null; } return emptyList.get(0); hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -100,7 +100,7 @@ public static String engineerId = ""; @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 500) public void plcHomeEdgTask() { Date startDate = new Date(); log.info("本次任务开始执行时间:{}", startDate); @@ -110,16 +110,22 @@ String confirmationWrodValue = plcParameterObject.getPlcParameter("MES_confirmation_word").getValue(); //A08 A09表示线路相同 可做等价 无数据转int异常 String out08Glassstate = plcParameterObject.getPlcParameter("A08_glass_status").getValue(); String out09Glassstate = plcParameterObject.getPlcParameter("A09_glass_status").getValue(); String out10Glassstate = plcParameterObject.getPlcParameter("A10_glass_status").getValue(); String confirmationWrodAddress = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress(); String currentSlot = plcParameterObject.getPlcParameter("Current_slot").getValue(); // taskRequestTypeValue = "2"; if ("1".equals(out09Glassstate)) { log.info("A09空闲"); out08Glassstate = "1"; } // taskRequestTypeValue = "3"; // out08Glassstate = "1"; // out10Glassstate = "1"; // currentSlot = "5"; // currentSlot = "1"; // confirmationWrodValue = "0"; // glassIdeValue = "P24092706|15|5"; // glassIdeValue = "P24110201|17|1"; log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:A09:{}、A10:{},当前格子号为:{}", taskRequestTypeValue, glassIdeValue, confirmationWrodValue, out08Glassstate, out10Glassstate, currentSlot); @@ -141,12 +147,12 @@ if ("1".equals(taskRequestTypeValue) && result) { log.info("2、进片请求,且确认字为0,执行进片任务,扫码重复ID验证【有重复=false,无重复=true】:{}", result); inTo(glassIdeValue, confirmationWrodAddress, currentSlot); } else if ("2".equals(taskRequestTypeValue)) { } else if ("2".equals(taskRequestTypeValue) && result) { //09空闲 :1 10空闲 :2 都空闲:3 其他0 log.info("2、出片请求,且确认字为0,执行出片任务"); outTo(Integer.parseInt(out08Glassstate), Integer.parseInt(out10Glassstate), confirmationWrodAddress, "", Integer.parseInt(currentSlot)); } else if ("3".equals(taskRequestTypeValue)) { } else if ("3".equals(taskRequestTypeValue) && result) { log.info("2、进片和出片都空闲,执行出片任务"); //加笼子里面是否有玻璃,有先出,无玻璃先进 boolean outFlase = outTo(Integer.parseInt(out08Glassstate), @@ -161,7 +167,7 @@ } @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 500) public void dealDamageTask() { Date startDate = new Date(); log.info("卧式理片破损玻璃清除任务开始执行时间:{}", startDate); @@ -346,15 +352,26 @@ // 1.2.3、按照出片信息去详情表查询格子在笼子里面剩余相同尺寸的玻璃数据且以版图id、版序升序排序 取第一块玻璃出片 // 2、如果没有历史出片任务 // 2.1、出当前版图id最小版序最小的玻璃(问题:两条线都没有历史任务,出片时两条线的玻璃尺寸相同,是否找尺寸不同的) if ((out08Glassstate == 2 && out10Glassstate == 2) || (out08Glassstate == 0 && out10Glassstate == 0)) { // if ((out08Glassstate == 2 && out10Glassstate == 2) || (out08Glassstate == 0 && out10Glassstate == 0)) { // log.info("A09、A10为{},{}非自动状态,无法出片", out08Glassstate, out10Glassstate); // return Boolean.FALSE; // } if ((out08Glassstate == 2 && out10Glassstate == 2)) { log.info("A09、A10为{},{}非自动状态,无法出片", out08Glassstate, out10Glassstate); return Boolean.FALSE; } if ((out08Glassstate == 0 && out10Glassstate == 0)) { out10Glassstate = 1; } log.info("0、出片任务出的状态:A09:【{}】;A10:【{}】)", out08Glassstate, out10Glassstate); //定义出片玻璃信息 int endcell = 0; EdgStorageCageDetails glassInfo = null; //当笼子已满时,不考虑卧式理片前的玻璃 EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot, Boolean.FALSE); if (nearestEmpty == null) { glassId = ""; } boolean flag = queryMaxMinDiff(threshold); log.info("1、获取钢化版图是否超过阈值:{}", flag); @@ -376,7 +393,7 @@ if (out08Glassstate == 1 && out10Glassstate == 1) { EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL); EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL); if (a09EdgGlass == null && a10EdgGlass == null) { if (a09EdgGlass != null || a10EdgGlass != null) { MPJQueryWrapper<EdgStorageCageDetails> wrapper = new MPJQueryWrapper<>(); wrapper.select("count(t.glass_id), t.width, t.height") .eq("t.state", Const.GLASS_STATE_IN) @@ -780,10 +797,10 @@ glassInfo = currentGlass; } } //玻璃信息替换 String glassIdChange = queryAndChangeGlass(glassInfo.getGlassId()); //处理在卧理内的玻璃信息:笼内的数据处理 queryEdgAndChangeGlass(glassInfo.getGlassId(), glassIdChange); // //玻璃信息替换 // String glassIdChange = queryAndChangeGlass(glassInfo.getGlassId()); // //处理在卧理内的玻璃信息:笼内的数据处理 // queryEdgAndChangeGlass(glassInfo.getGlassId(), glassIdChange); LambdaUpdateWrapper<EdgStorageCageDetails> wrapper = new LambdaUpdateWrapper<>(); wrapper.eq(EdgStorageCageDetails::getGlassId, glassInfo.getGlassId()).set(EdgStorageCageDetails::getState, Const.GLASS_STATE_OUT); edgStorageCageDetailsService.update(wrapper); @@ -859,20 +876,31 @@ * @return */ private int computerLineByState(int out08Glassstate, int out10Glassstate) { if (out08Glassstate == 0) { if (out10Glassstate == 2) { return Const.A09_OUT_TARGET_POSITION; } else { // if (out08Glassstate == 0) { // if (out10Glassstate == 2) { // return Const.A09_OUT_TARGET_POSITION; // } else { // return Const.A10_OUT_TARGET_POSITION; // } // } else if (out08Glassstate == 1) { // return Const.A09_OUT_TARGET_POSITION; // } else { // return Const.A10_OUT_TARGET_POSITION; // } if (out10Glassstate == 0) { if (out08Glassstate == 2) { return Const.A10_OUT_TARGET_POSITION; } else { return Const.A09_OUT_TARGET_POSITION; } } else if (out08Glassstate == 1) { return Const.A09_OUT_TARGET_POSITION; } else { } else if (out10Glassstate == 1) { return Const.A10_OUT_TARGET_POSITION; } else { return Const.A09_OUT_TARGET_POSITION; } } @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 500) public void CacheGlassTasks() { JSONObject jsonObject = new JSONObject(); List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); @@ -899,7 +927,7 @@ } } @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 500) public void cacheGlassIsRun() { JSONObject jsonObject = new JSONObject(); //正在进行的任务 @@ -917,7 +945,7 @@ } } @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 500) public void CacheGlassTaskss() { JSONObject jsonObject = new JSONObject(); //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys); hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/JsonFile/PlcCacheGlass.json
@@ -51,14 +51,20 @@ "addressLenght":"2", "ratio":"1", "unit":"" } , }, { "codeId": "A10_prohibit_film_production", "addressIndex":"74", "addressLenght":"2", "ratio":"1", "unit":"" }, { "codeId": "A09_glass_status", "addressIndex": "76", "addressLenght": "2", "ratio": "1", "unit": "" } ] } hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
@@ -8,6 +8,11 @@ name: cacheGlass liquibase: enabled: false task: scheduling: pool: size: 10 thread-name-prefix: task-cache mybatis-plus: mapper-locations: classpath*:mapper/*.xml # configuration: hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/CacheVerticalClassModuleApplication.java
@@ -18,7 +18,7 @@ @EnableSwagger2WebMvc @EnableDiscoveryClient @MapperScan(basePackages = "com.mes.*.mapper") @EnableScheduling //@EnableScheduling public class CacheVerticalClassModuleApplication { public static void main(String[] args) { try { hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -325,11 +325,15 @@ .groupBy(BigStorageCageDetails::getEngineerId) .between(BigStorageCageDetails::getDeviceId, 6, 8) ); if (glassInfo.getThickness() == 8) { deviceUsedList.removeIf(device -> device < 6); } else { if (engineerCount1.size() > engineerCount2.size()) { deviceUsedList.removeIf(device -> device < 6); } else { deviceUsedList.removeIf(device -> device > 5); } } if (CollectionUtils.isEmpty(deviceUsedList)) { deviceUsedList = deviceUseds; } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcSlicecage.java
@@ -118,7 +118,7 @@ * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) * fixedDelay : 上一个调用结束后再次调用的延时 */ @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 300) public void plcStorageCageTask() throws InterruptedException { jsonObject = new JSONObject(); try { @@ -147,7 +147,7 @@ } } @Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 300) public void temperingIsRun() { JSONObject jsonObject = new JSONObject(); //进片任务数据 @@ -168,7 +168,7 @@ } } @Scheduled(fixedDelay = Long.MAX_VALUE) // @Scheduled(fixedDelay = Long.MAX_VALUE) public void scanCodeTask() { log.info("扫描任务已启动"); while (true) { hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -116,6 +116,11 @@ String d01ToMES = plcParameterObject.getPlcParameter("D01ToMES").getValue(); String d04ToMES = plcParameterObject.getPlcParameter("D04ToMES").getValue(); // d04Id="P24110503|17|4"; // d04ToMES="1"; // d01ToMES="1"; log.info("1、获取d01Id扫描ID为:{},请求字为{};获取d04Id扫描ID为:{},请求字为{};", d01Id, d01ToMES, d04Id, d04ToMES); if (StringUtils.isBlank(d01ToMES) && StringUtils.isBlank(d04ToMES)) { log.info("两条线未收到进片任务,结束本次扫描进卧转立任务"); @@ -168,6 +173,7 @@ public void plcToHomeEdgFreeCarTask() { Date startDate = new Date(); log.info("大理片笼空车进片任务开始执行时间:{}", startDate); PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject; String mesD03Address = plcMesObject.getPlcParameter("MESToD03").getValue(); String mesD05Address = plcMesObject.getPlcParameter("MESToD05").getValue(); @@ -295,6 +301,7 @@ computeTargetByLine(outLine); } Date endDate = new Date(); log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); } @@ -738,7 +745,7 @@ BigStorageCageDetails bigStorageCageDetails = bigStorageCageDetailsService.getOne( new LambdaQueryWrapper<BigStorageCageDetails>() .eq(BigStorageCageDetails::getGlassId, glassId) .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) ); if (bigStorageCageFeedTask != null || bigStorageCageDetails != null) { log.info("此玻璃存任务或已在笼内"); @@ -919,6 +926,8 @@ Map<String, GlassInfo> glassInfoMap = glassInfos.stream() .collect(Collectors.toMap(GlassInfo::getGlassId, p -> p)); for (BigStorageCageFeedTask e : taskList) { //替换玻璃id queryAndChangeGlass(e.getGlassId()); GlassInfo info = glassInfoMap.get(e.getGlassId()); if (info == null) { continue; @@ -1160,4 +1169,34 @@ return sitToUpRemainWidth.getWidth() < Math.max(glassInfo.getWidth(), glassInfo.getHeight()); } public String queryAndChangeGlass(String glassId) { GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); Assert.isFalse(null == glassInfo, "玻璃信息不存在"); //按照玻璃尺寸 LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>() .eq(GlassInfo::getWidth, glassInfo.getWidth()) .eq(GlassInfo::getHeight, glassInfo.getHeight()) .eq(GlassInfo::getThickness, glassInfo.getThickness()) .eq(GlassInfo::getFilmsid, glassInfo.getFilmsid()) .eq(GlassInfo::getFlowCardId, glassInfo.getFlowCardId()) .eq(GlassInfo::getTotalLayer, glassInfo.getTotalLayer()) .eq(GlassInfo::getLayer, glassInfo.getLayer()) .eq(GlassInfo::getEngineerId, glassInfo.getEngineerId()) .notInSql(GlassInfo::getGlassId, "select distinct glass_id from big_storage_cage_details " + "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight()) .orderByAsc(GlassInfo::getTemperingLayoutId) .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence) .last("Limit 1"); GlassInfo swapGlassInfo = glassInfoService.getOne(queryWrapper); if (swapGlassInfo != null && !glassInfo.getGlassId().equals(swapGlassInfo.getGlassId())) { String swapGlassId = swapGlassInfo.getGlassId(); log.info("将玻璃{}和玻璃{},信息互换,进玻璃 {}", glassInfo, swapGlassInfo, swapGlassInfo); swapGlassInfo.setGlassId(glassId); glassInfo.setGlassId(swapGlassId); glassInfoService.updateById(swapGlassInfo); glassInfoService.updateById(glassInfo); return swapGlassId; } return ""; } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
@@ -11,12 +11,12 @@ task: scheduling: pool: size: 10 size: 2 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 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
@@ -35,7 +35,6 @@ END MAX_LENGTH FROM BIG_STORAGE_CAGE_FEED_TASK WHERE LINE = #{line} AND (target_slot = 0 or target_slot is null) AND TASK_STATE IN (1, 2) and deleted = 0 ) T hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
@@ -4,13 +4,16 @@ import cn.hutool.json.JSONObject; 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.toolkit.CollectionUtils; import com.fasterxml.jackson.databind.ObjectMapper; import com.mes.bigstorage.entity.BigStorageCage; import com.mes.bigstorage.entity.BigStorageCageDetails; import com.mes.bigstorage.service.BigStorageCageDetailsService; import com.mes.bigstorage.service.BigStorageCageService; import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; import com.mes.common.config.Const; import com.mes.damage.entity.Damage; import com.mes.damage.service.DamageService; @@ -56,6 +59,9 @@ DamageService damageService; @Autowired EdgGlassTaskInfoService edgGlassTaskInfoService; @Autowired BigStorageCageFeedTaskService bigStorageCageFeedTaskService; // @Autowired // BigStorageCageFeedTaskMapper bigStorageCageFeedTaskMapper; @@ -229,6 +235,24 @@ log.info("zhi:{}",deviceUsedList); } @Test public void ca1() { 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)) { log.info("zhi:" + bigStorageCageFeedTasks); } } @Test public void ca11() { plcStorageCageTask.queryAndChangeGlass("P24110503|17|4"); } @Test public void ca(){ hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
@@ -5,7 +5,7 @@ strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 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 hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
@@ -2,15 +2,15 @@ port: 8083 spring: profiles: active: dev active: cz application: name: loadGlass liquibase: enabled: false 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 kangaroohy: milo: enabled: false hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
@@ -7,10 +7,15 @@ name: temperingGlass liquibase: enabled: false task: scheduling: pool: size: 10 thread-name-prefix: task-tempering 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: width: 2800 height: 5000 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstionAndDownGlassinfo.java
@@ -48,12 +48,22 @@ */ private Integer workState; /** * 总数量 */ private Integer totalQuantity; /** * 下片数 */ private Integer racksNumber; /** * 其他数 */ private Integer otherNumber; /** * 顺序 */ private Integer sequence; hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -86,7 +86,7 @@ item.put("width", downWorkstionAndDownGlassinfo.getTotalwidth()); item.put("fillColor", "yellow"); item.put("content", downWorkstionAndDownGlassinfo.getFlowCardId()); if (downWorkstionAndDownGlassinfo.getFlowCardId() != "" && downWorkstionAndDownGlassinfo.getFlowCardId() != null && downWorkstionAndDownGlassinfo.getTotalQuantity() == downWorkstionAndDownGlassinfo.getRacksNumber() + downWorkstionAndDownGlassinfo.getRacksNumber()) { if (downWorkstionAndDownGlassinfo.getFlowCardId() != "" && downWorkstionAndDownGlassinfo.getFlowCardId() != null && downWorkstionAndDownGlassinfo.getTotalQuantity() == downWorkstionAndDownGlassinfo.getRacksNumber() + downWorkstionAndDownGlassinfo.getOtherNumber()) { item.put("fullCardColor", "red"); } else { item.put("fullCardColor", "blue");