| | |
| | | } |
| | | |
| | | |
| | | //读取String |
| | | //读取StringList |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | //读取字符串 |
| | | public String readString(String address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | return new String(bytes, StandardCharsets.UTF_8); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | try { |
| | | |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | url: jdbc:mysql://localhost:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | server-addr: localhost:8848 |
| | | application: |
| | | name: security |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | host: localhost |
| | | port: 6379 |
| | | password: |
| | | session: |
| | |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | server-addr: localhost:8848 |
| | | gateway: |
| | | discovery: |
| | | locator: |
| | |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.microsoft.sqlserver</groupId> |
| | | <artifactId>sqljdbc4</artifactId> |
| | | <version>4.0</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.yulichang</groupId>--> |
| | | <!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.PlcHomeEdg; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @Order(1) |
| | | |
| | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // TODO Auto-generated method stub |
| | | // |
| | | //System.out.println("启动完成"); |
| | | log.info("启动完成"); |
| | | new PlcHomeEdg().start(); |
| | | |
| | | } |
| | |
| | | import java.io.BufferedReader; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public class InitUtil { |
| | | //初始化word |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"208", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "PLCToMES", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus1", |
| | | "addressIndex":"2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus2", |
| | | "addressIndex":"4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus3", |
| | | "addressIndex":"6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus4", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus5", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "IDStatus6", |
| | | "addressIndex":"12", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID1", |
| | | "addressIndex":"14", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID2", |
| | | "addressIndex":"16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID3", |
| | | "addressIndex":"18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID4", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID5", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID6", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "GaToMES", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "Height", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex":"30", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "ExportTOMES1", |
| | | "addressIndex":"32", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "ExportToMES2", |
| | | "addressIndex":"34", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESToPLC", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID1", |
| | | "addressIndex":"38", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID2", |
| | | "addressIndex":"54", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID3", |
| | | "addressIndex":"70", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID4", |
| | | "addressIndex":"86", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID5", |
| | | "addressIndex":"102", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID6", |
| | | "addressIndex":"118", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESToPLCStart1", |
| | | "addressIndex":"134", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart2", |
| | | "addressIndex":"136", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart3", |
| | | "addressIndex":"138", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart4", |
| | | "addressIndex":"140", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart5", |
| | | "addressIndex":"142", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart6", |
| | | "addressIndex":"144", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget1", |
| | | "addressIndex":"146", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget2", |
| | | "addressIndex":"148", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget3", |
| | | "addressIndex":"150", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget4", |
| | | "addressIndex":"152", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget5", |
| | | "addressIndex":"154", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget6", |
| | | "addressIndex":"156", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus1", |
| | | "addressIndex":"158", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus2", |
| | | "addressIndex":"160", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus3", |
| | | "addressIndex":"162", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus4", |
| | | "addressIndex":"164", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus5", |
| | | "addressIndex":"166", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus6", |
| | | "addressIndex":"168", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToGaStatus", |
| | | "addressIndex":"170", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01Err", |
| | | "addressIndex":"172", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02Err", |
| | | "addressIndex":"174", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Err", |
| | | "addressIndex":"176", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Err", |
| | | "addressIndex":"178", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Err", |
| | | "addressIndex":"180", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace1", |
| | | "addressIndex":"182", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace2", |
| | | "addressIndex":"184", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace3", |
| | | "addressIndex":"186", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Position", |
| | | "addressIndex":"188", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Position", |
| | | "addressIndex":"190", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Position", |
| | | "addressIndex":"192", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "DeviceState", |
| | | "addressIndex":"194", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "AllFVRun", |
| | | "addressIndex":"196", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01State", |
| | | "addressIndex":"198", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02State", |
| | | "addressIndex":"200", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01State", |
| | | "addressIndex":"202", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01State", |
| | | "addressIndex":"204", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02State", |
| | | "addressIndex":"206", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ] |
| | | } |
| | |
| | | package com.mes.common; |
| | | |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import static com.mes.common.InitUtil.readAndUpdateWordValues; |
| | | |
| | | public class PLCAutoMes extends Thread { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(PLCAutoMes.class); |
| | | private static InitUtil initUtil; |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | private static String PlcAlbania = PLCAutoMes.class.getResource("/JsonFile/PlcAlbania.json").getPath(); |
| | | private static String PlcAlbania; |
| | | |
| | | |
| | | |
| | | public static PlcParameterObject PlcMesObject = InitUtil.initword(PlcAlbania); |
| | | public static PlcParameterObject PlcMesObject; |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | PlcAlbania="D:\\SQL\\PlcCacheGlass.json"; |
| | | // PlcAlbania=PLCAutoMes.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); |
| | | //log.info(PLCAutoMes.class.getResource("").getPath()); |
| | | PlcMesObject = InitUtil.initword(PlcAlbania); |
| | | initUtil = new InitUtil(); |
| | | } |
| | | |
| | |
| | | package com.mes.common; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.github.yulichang.query.MPJLambdaQueryWrapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.mapper.TaskCacheMapper; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class PlcHomeEdg extends Thread { |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | TaskCacheService taskCacheService; |
| | | @Autowired |
| | | GlassInfoService glassInfoService; |
| | | @Autowired |
| | | EdgStorageCageService edgStorageCageService; |
| | | @Autowired |
| | | EdgStorageCageDetailsService edgStorageCageDetailsService; |
| | | @Autowired |
| | | private EdgStorageCageDetailsMapper edgStorageCageDetailsMapper; |
| | | |
| | | private Map<String,String> mapParameter=new HashMap<String,String>(); |
| | | private Map<String,String> mapValue=new HashMap<String,String>(); |
| | | private Map<String,Object> mapSettings=new HashMap<String,Object>(); |
| | | |
| | | |
| | | private void initialize(){ |
| | | mapParameter.put("A06_request_word","DB11.0"); |
| | | mapParameter.put("A05_scanning_ID","DB11.2"); |
| | | mapParameter.put("MES_confirmation_word","DB11.40"); |
| | | mapParameter.put("A09_glass_status","DB11.70"); |
| | | mapParameter.put("A10_glass_status","DB11.72"); |
| | | mapParameter.put("A09_prohibit_film_production","DB11.74"); |
| | | mapParameter.put("A10_prohibit_film_production","DB11.76"); |
| | | mapSettings.put("territoryPoor",3); |
| | | |
| | | // mapValue.put("A06_request_word","1");//请求字 |
| | | // mapValue.put("A05_scanning_ID","7");//请求ID |
| | | // mapValue.put("MES_confirmation_word","0");//MES发送字 |
| | | // mapValue.put("A09_glass_status","0");//A09玻璃状态 |
| | | // mapValue.put("A10_glass_status","0");//A09玻璃状态 |
| | | // mapValue.put("A09_prohibit_film_production","0");//A9禁止出片 |
| | | // mapValue.put("A10_prohibit_film_production","0");//A10禁止出片 |
| | | for (String key:mapParameter.keySet()){ |
| | | String value=S7object.getinstance().plccontrol.readString(mapParameter.get(key)); |
| | | mapValue.put(key,value); |
| | | } |
| | | } |
| | | private void inTo(){ |
| | | List<GlassInfo> glassInfos=glassInfoService.selectId(mapValue.get("A05_scanning_ID")); |
| | | if(glassInfos.size()<1){ |
| | | log.info("此玻璃编号不存在"); |
| | | }else if(glassInfos.size()==1){ |
| | | //添加进片任务 查找空格 |
| | | log.info("正常"); |
| | | List<EdgStorageCage> list=edgStorageCageService.selectCacheEmpty(); |
| | | |
| | | if(list.size()>1){ |
| | | EdgStorageCageDetails edgStorageCageDetails=edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getGlassId,glassInfos.get(0).getGlassId())); |
| | | edgStorageCageDetails.setState(200); |
| | | |
| | | TaskCache taskCache=new TaskCache(); |
| | | EdgStorageCage edgStorageCage=list.get(0); |
| | | taskCache.setGlassId(glassInfos.get(0).getGlassId()); |
| | | taskCache.setTaskStatus(0); |
| | | taskCache.setStartCell(0); |
| | | taskCache.setEndCell(edgStorageCage.getSlot()); |
| | | taskCache.setTaskType(1); |
| | | taskCache.setCreateTime(new DateTime()); |
| | | edgStorageCageDetailsMapper.updateById(edgStorageCageDetails); |
| | | taskCacheService.insertTaskCache(taskCache); |
| | | }else{ |
| | | log.info("不存在空格"); |
| | | } |
| | | }else{ |
| | | log.info("此玻璃编号存在多个"); |
| | | } |
| | | } |
| | | private void outTo(int line){ |
| | | int endcell=0; |
| | | EdgStorageCageDetails outEdgStorageCageDetails=new EdgStorageCageDetails(); |
| | | TaskCache taskCacheA09=taskCacheService.selectLastOutCacheInfo(""); |
| | | TaskCache taskCacheA10=taskCacheService.selectLastOutCacheInfo(""); |
| | | //两线各自要出的玻璃 |
| | | EdgStorageCageDetails glassInfo09=edgStorageCageDetailsService.selectConformGlass(taskCacheA09.getGlassId(),(int)mapSettings.get("territoryPoor")); |
| | | EdgStorageCageDetails glassInfo10=edgStorageCageDetailsService.selectConformGlass(taskCacheA10.getGlassId(),(int)mapSettings.get("territoryPoor")); |
| | | //决定线路 |
| | | if(line==1){ |
| | | endcell=9000; |
| | | outEdgStorageCageDetails=glassInfo09; |
| | | }else if(line==2){ |
| | | endcell=1000; |
| | | outEdgStorageCageDetails=glassInfo10; |
| | | }else if(line==3){ |
| | | endcell=9000;//默认走一号线 优化方向可根据 对比两线速度/两线当前任务情况做 |
| | | outEdgStorageCageDetails=glassInfo09; |
| | | } |
| | | if(outEdgStorageCageDetails!=null&&endcell>0){ |
| | | TaskCache taskCache=new TaskCache(); |
| | | taskCache.setGlassId(outEdgStorageCageDetails.getGlassId()); |
| | | taskCache.setTaskStatus(0); |
| | | taskCache.setStartCell(outEdgStorageCageDetails.getSlot()); |
| | | taskCache.setEndCell(endcell); |
| | | taskCache.setTaskType(2); |
| | | taskCache.setCreateTime(new DateTime()); |
| | | taskCacheService.insertTaskCache(taskCache); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | boolean start=true; |
| | | while (this != null&&start) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |
| | | Thread.sleep(1000); |
| | | taskCacheService = WebSocketServer.applicationContext.getBean(TaskCacheService.class); |
| | | glassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class); |
| | | edgStorageCageService = WebSocketServer.applicationContext.getBean(EdgStorageCageService.class); |
| | | edgStorageCageDetailsMapper = WebSocketServer.applicationContext.getBean(EdgStorageCageDetailsMapper.class); |
| | | initialize();//初始化数据 |
| | | log.info("当前参数值:{}",mapValue); |
| | | if("0".equals(mapValue.get("A06_request_word"))){ |
| | | //清除 |
| | | //S7object.getinstance().plccontrol.WriteWord(mapParameter.get("MES_confirmation_word"),(short) 0); |
| | | }else if("1".equals(mapValue.get("A06_request_word"))&& |
| | | "0".equals(mapValue.get("MES_confirmation_word"))) |
| | | { |
| | | |
| | | inTo(); |
| | | }else if("2".equals(mapValue.get("A06_request_word"))&& |
| | | "0".equals(mapValue.get("MES_confirmation_word"))&& |
| | | ( |
| | | "0".equals(mapValue.get("A09_glass_status"))|| |
| | | "0".equals(mapValue.get("A10_glass_status")) |
| | | ) |
| | | ){ |
| | | |
| | | outTo(3); |
| | | }else if("3".equals(mapValue.get("A06_request_word"))&& |
| | | "0".equals(mapValue.get("MES_confirmation_word"))){ |
| | | |
| | | if("0".equals(mapValue.get("A09_glass_status"))||"0".equals(mapValue.get("A10_glass_status"))){ |
| | | outTo(3); |
| | | }else{ |
| | | inTo(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // List<String> address2=new ArrayList<String>(); |
| | | // address.add(""); |
| | | // List<String> list2= S7object.getinstance().plccontrol.readStrings(address); |
| | | // PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | // log.info("plcmes:{}",plcmes); |
| | | // S7object.getinstance().plccontrol.WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | |
| | | // taskCacheMapper = WebSocketServer.applicationContext.getBean(TaskCacheMapper.class); |
| | | // List<TaskCache> list=taskCacheMapper.selectList(null); |
| | | // log.info("数据{}",list); |
| | | // 注入mapper |
| | | // HomeService = WebSocketServer.applicationContext.getBean(HomeService.class); |
| | | // QueueMapper = WebSocketServer.applicationContext.getBean(QueueMapper.class); |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // log.info("推数据"); |
| | | // jsonObject.append("params", new short[] { 30, 40, }); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | | if (sendwServer != null) { |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.tools.S7control; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | } |
| | |
| | | @ApiOperation("磨边缓存理片笼信息 功能:对笼内栅格玻璃进行【清除/更换/绑定】 EdgStorageCage格子信息,EdgStorageCageDetails 玻璃信息 ") |
| | | @PostMapping("/edgStorageCageGlass") |
| | | @ResponseBody |
| | | public Result edgStorageCageGlass(@RequestBody EdgStorageCage edgStorageCage,@RequestBody EdgStorageCageDetails edgStorageCageDetails) { |
| | | boolean isSucess=edgStorageCageService.updateEdgStorageCageDetails(edgStorageCage,edgStorageCageDetails); |
| | | public Result edgStorageCageGlass(@RequestBody EdgStorageCageDetails edgStorageCageDetails,int edgStorageCageId) { |
| | | boolean isSucess=edgStorageCageService.updateEdgStorageCageDetails(edgStorageCageId,edgStorageCageDetails); |
| | | return Result.build(200,"删除成功",1); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private Integer glassId; |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | List<Map<String, Object>> selectCurrentCutTerritory(String current); |
| | | |
| | | |
| | | /** |
| | | * 查询笼内版图差值范围内的 此尺寸玻璃 如无则按照 钢化版图序号 以及玻璃序号 |
| | | * @param glassId |
| | | * @param poor |
| | | * @return |
| | | */ |
| | | EdgStorageCageDetails selectConformGlass(String glassId, int poor); |
| | | } |
| | |
| | | * 查询笼内空格 |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> selectCacheEmpty(); |
| | | List<EdgStorageCage> selectCacheEmpty(); |
| | | |
| | | /** |
| | | * 查询笼内出片顺序详情 |
| | |
| | | */ |
| | | boolean updateEdgStorageCage(EdgStorageCage edgStorageCage); |
| | | |
| | | boolean updateEdgStorageCageDetails(EdgStorageCage edgStorageCage, EdgStorageCageDetails edgStorageCageDetails); |
| | | boolean updateEdgStorageCageDetails(int edgStorageCageId, EdgStorageCageDetails edgStorageCageDetails); |
| | | } |
| | |
| | | package com.mes.edgstoragecage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJLambdaQueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import com.mes.pp.entity.OptimizeLayout; |
| | | import com.mes.pp.mapper.OptimizeDetailMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | @Autowired |
| | | OptimizeDetailMapper optimizeDetailMapper; |
| | | |
| | | @Autowired |
| | | EdgStorageCageMapper edgStorageCageMapper; |
| | | |
| | | /** |
| | | * 识别 拿走:200/破损:201 |
| | |
| | | // ); |
| | | } |
| | | |
| | | /** |
| | | * 查询笼内版图差值范围内的 此尺寸玻璃 如无则按照 钢化版图序号 以及玻璃序号 |
| | | * @param glassId |
| | | * @param poor |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EdgStorageCageDetails selectConformGlass(String glassId, int poor){ |
| | | //1.去笼内查询此尺寸的玻璃 目前版图差值内的玻璃 是否有同尺寸的 |
| | | //1.1 有同尺寸的 则生成同尺寸的任务 |
| | | //1.2 无同尺寸的 则生成版图顺序最小的出片 |
| | | EdgStorageCageDetails edgStorageCageDetails= baseMapper.selectOne(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getGlassId,glassId) |
| | | ); |
| | | List<EdgStorageCageDetails> listEdgStorageCageDetails= baseMapper.selectList(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .lt(EdgStorageCageDetails::getState,200) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId,EdgStorageCageDetails::getTemperingFeedSequence) |
| | | ); |
| | | EdgStorageCageDetails minTemperingLayoutId=new EdgStorageCageDetails(); |
| | | if(!listEdgStorageCageDetails.isEmpty()){ |
| | | minTemperingLayoutId=listEdgStorageCageDetails.get(0); |
| | | } |
| | | EdgStorageCageDetails result=new EdgStorageCageDetails(); |
| | | if(edgStorageCageDetails!=null&&minTemperingLayoutId!=null){ |
| | | result=edgStorageCageMapper.selectJoinOne(EdgStorageCageDetails.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | .isNotNull(EdgStorageCageDetails::getSlot) |
| | | .eq(EdgStorageCageDetails::getWidth,edgStorageCageDetails.getWidth()) |
| | | .eq(EdgStorageCageDetails::getHeight,edgStorageCageDetails.getHeight()) |
| | | .ge(EdgStorageCageDetails::getTemperingLayoutId,minTemperingLayoutId.getTemperingLayoutId()) |
| | | .le(EdgStorageCageDetails::getTemperingLayoutId,minTemperingLayoutId.getTemperingLayoutId()+poor) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId,EdgStorageCageDetails::getTemperingFeedSequence) |
| | | ); |
| | | } |
| | | |
| | | if (result==null){ |
| | | result=edgStorageCageMapper.selectJoinOne(EdgStorageCageDetails.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | .isNotNull(EdgStorageCageDetails::getSlot) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId,EdgStorageCageDetails::getTemperingFeedSequence) |
| | | ); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.Map; |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class EdgStorageCageServiceImpl extends MPJBaseServiceImpl<EdgStorageCageMapper, EdgStorageCage> implements EdgStorageCageService { |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectCacheEmpty(){ |
| | | return baseMapper.selectJoinMaps(JoinWrappers.lambda(EdgStorageCage.class).selectAll(EdgStorageCage.class) |
| | | .select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight,EdgStorageCageDetails::getGlassId) |
| | | public List<EdgStorageCage> selectCacheEmpty(){ |
| | | return baseMapper.selectJoinList(EdgStorageCage.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCage.class) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | .isNull(EdgStorageCageDetails::getSlot) |
| | | ); |
| | | |
| | | // return baseMapper.selectJoinMaps(JoinWrappers.lambda(EdgStorageCage.class).selectAll(EdgStorageCage.class) |
| | | // .select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight,EdgStorageCageDetails::getGlassId) |
| | | // .leftJoin(EdgStorageCageDetails.class,on->on |
| | | // .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | // .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | // .isNull(EdgStorageCageDetails::getSlot) |
| | | // ); |
| | | |
| | | // return baseMapper.selectJoinMaps(new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class) |
| | | // .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | |
| | | |
| | | /** |
| | | *修改理片笼信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | * @param edgStorageCage |
| | | * @param edgStorageCageId |
| | | * @param edgStorageCageDetails |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateEdgStorageCageDetails(EdgStorageCage edgStorageCage,EdgStorageCageDetails edgStorageCageDetails){ |
| | | EdgStorageCage edgItem=baseMapper.selectById(edgStorageCage.getId()); |
| | | public boolean updateEdgStorageCageDetails(int edgStorageCageId,EdgStorageCageDetails edgStorageCageDetails){ |
| | | EdgStorageCage edgItem=baseMapper.selectById(edgStorageCageId); |
| | | log.info("正常"+edgItem); |
| | | EdgStorageCageDetails edgDItem=edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | if (edgItem!=null){ |
| | | if(edgDItem==null){ |
| | | //移除玻璃 |
| | | EdgStorageCageDetails result=edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getId,edgStorageCageDetails.getId())); |
| | | //移除 |
| | | EdgStorageCageDetails result=edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot,edgStorageCageId)); |
| | | if (result!=null){ |
| | | result.setSlot(0); |
| | | edgStorageCageDetailsMapper.updateById(result); |
| | | }else{ |
| | | //1.绑定新的玻璃 2.更换玻璃 上一片清除 重新绑定 |
| | | EdgStorageCageDetails lastResult=edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot,edgStorageCage.getSlot())); |
| | | lastResult.setSlot(0); |
| | | edgStorageCageDetailsMapper.updateById(lastResult); |
| | | EdgStorageCageDetails result=edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | result.setSlot(edgStorageCageDetails.getSlot()); |
| | | edgStorageCageDetailsMapper.updateById(result); |
| | | } |
| | | //添加 |
| | | if(edgDItem!=null){ |
| | | //只传格子 :移除玻璃 |
| | | EdgStorageCageDetails newresult=edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | newresult.setSlot(edgItem.getSlot()); |
| | | edgStorageCageDetailsMapper.updateById(newresult); |
| | | } |
| | | } |
| | | return true; |
| | |
| | | package com.mes.taskcache.entity; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("task_cache") |
| | | public class TaskCache { |
| | | private String ID;//任务编号 |
| | | private String startCell;//起始 |
| | | private String endCell;//结束 |
| | | private String taskType;//任务类型 |
| | | private String taskStatus;//任务状态 |
| | | private String glassId;//任务编号 |
| | | private int startCell;//起始 |
| | | private int endCell;//结束 |
| | | private int taskType;//任务类型 |
| | | private int taskStatus;//任务状态 |
| | | private DateTime createTime;//任务状态 |
| | | |
| | | } |
| | |
| | | package com.mes.taskcache.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @DS("salve_hangzhoumes") |
| | | public interface TaskCacheMapper extends BaseMapper<TaskCache> { |
| | | |
| | | } |
| | |
| | | package com.mes.taskcache.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param line |
| | | * @return |
| | | */ |
| | | List<TaskCache> selectLastOutCacheInfo(String line); |
| | | List<TaskCache> selectLastOutCacheInfos(String line); |
| | | |
| | | /** |
| | | * 查询 A09 或 A10 最新的一片 出片任务 |
| | | * @param line |
| | | * @return |
| | | */ |
| | | TaskCache selectLastOutCacheInfo(String line); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.query.MPJLambdaQueryWrapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | |
| | | */ |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | |
| | | |
| | | /** |
| | | * 添加理片笼任务 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectLastOutCacheInfo(String line){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell,line).eq(TaskCache::getTaskStatus,1).orderByDesc(TaskCache::getID)); |
| | | public List<TaskCache> selectLastOutCacheInfos(String line){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell,line).eq(TaskCache::getTaskStatus,1).orderByDesc(TaskCache::getGlassId)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("end_cell",line).eq("task_status",1).orderByDesc("ID")); |
| | | } |
| | | |
| | | /** |
| | | * 查询 A09 或 A10 最新的一片 出片任务 |
| | | * @param line |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TaskCache selectLastOutCacheInfo(String line){ |
| | | return baseMapper.selectOne(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell,line).eq(TaskCache::getTaskStatus,1).orderByDesc(TaskCache::getGlassId)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://localhost:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | #url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://localhost:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://localhost: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 |
| | |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | server-addr: localhost:8848 |
| | | application: |
| | | name: cacheGlass |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | host: localhost |
| | | port: 6379 |
| | | password: 123456 |
| | | session: |
| | |
| | | import com.github.yulichang.query.MPJLambdaQueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageServiceImpl; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import com.mes.pp.entity.OptimizeLayout; |
| | | import com.mes.pp.mapper.OptimizeDetailMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.mapper.TaskCacheMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | EdgStorageCageDetailsService edgStorageCageDetailsService; |
| | | |
| | | @Autowired |
| | | TaskCacheMapper taskCacheMapper; |
| | | @Autowired |
| | | OptimizeDetailMapper optimizeDetailMapper; |
| | | @Autowired |
| | | GlassInfoService glassInfoService; |
| | | |
| | | @Test |
| | | public void testFindPath() { |
| | | log.info("完整路径:{}", Arrays.asList("123")); |
| | | String url=getClass().getResource("").getPath(); |
| | | log.info("完整路径:{}", Arrays.asList(url)); |
| | | } |
| | | |
| | | @Test |
| | | public void testSqlServer() { |
| | | List<TaskCache> list=taskCacheMapper.selectList(null); |
| | | log.info("数据{}",list); |
| | | log.info("Sql数据:{}", Arrays.asList(list)); |
| | | } |
| | | |
| | | @Test |
| | | public void testglassinfo() { |
| | | List<GlassInfo> glassInfos=glassInfoService.selectId("7"); |
| | | log.info("玻璃数据数据:{}", Arrays.asList(glassInfos)); |
| | | } |
| | | |
| | | @Test |
| | |
| | | } |
| | | @Test |
| | | public void testSelectCacheEmpty() { |
| | | List<Map<String, Object>> map= edgStorageCageService.selectCacheEmpty(); |
| | | List<EdgStorageCage> map= edgStorageCageService.selectCacheEmpty(); |
| | | log.info("笼内空格:{}", Arrays.asList(map)); |
| | | } |
| | | @Test |
| | |
| | | log.info("切割当前版图信息1:{}", Arrays.asList(map2)); |
| | | } |
| | | |
| | | @Test |
| | | public void testOutTask() { |
| | | EdgStorageCageDetails edgStorageCageDetails=edgStorageCageDetailsService.selectConformGlass("1",3); |
| | | |
| | | log.info("切割当前版图信息1:{}", Arrays.asList(edgStorageCageDetails)); |
| | | } |
| | | |
| | | } |
| | |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | | |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | |
| | | @Autowired |
| | |
| | | public List<DownStorageCageDetails> getCacheLeisure() { |
| | | log.info(" 查询笼子内空闲"); |
| | | List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNull("escd.slot") |
| | |
| | | public List<DownStorageCageDetails> getCacheOut(int start, int end) { |
| | | log.info("根据传入的工位查询符合按照顺序和大小出片的小片"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") |
| | |
| | | public List<Map> getCacheInfo() { |
| | | log.info(" 查询笼子内信息"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | Map.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | Map.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .orderByAsc("t.slot") |
| | |
| | | public List<DownStorageCageDetails> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) { |
| | | log.info(" 查询可进此片玻璃的栅格号 找到相同版图id并且大于前面的顺序的空格"); |
| | | List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNotNull("escd.slot") |
| | |
| | | public List<DownStorageCageDetails> IsExistIntoCacheByflowcardid(String flowcardid, double width) { |
| | | log.info(" 查询可进此片玻璃的栅格号"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNotNull("escd.slot") |
| | |
| | | public List<DownStorageCageDetails> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) { |
| | | log.info(" 查询可进此片玻璃的栅格号"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNotNull("escd.slot") |
| | |
| | | log.info(" 单片情况 查询可进此片玻璃的栅格号 找到相同流程卡号的空格"); |
| | | |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNotNull("escd.slot") |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.data.annotation.Id; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | //import javax.persistence.Id; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | |
| | | |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | //工位显示 |
| | | @Override |
| | | public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation() { |
| | | MPJQueryWrapper<DownWorkstionAndDownGlassinfo> queryWrapper = new MPJQueryWrapper<>(); |
| | | MPJQueryWrapper<DownWorkstation> queryWrapper = new MPJQueryWrapper<>(); |
| | | queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight") |
| | | .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id") |
| | | .groupBy("t.workstation_id", "t.flow_card_id"); |