Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
69个文件已修改
4 文件已重命名
20个文件已添加
20个文件已删除
| | |
| | | export default { |
| | | serverUrl: "10.153.19.150:88/api", |
| | | //serverUrl: "localhost:88/api/", |
| | | serverUrl: "10.153.19.150:88/api", |
| | | |
| | | serverUrl2: "10.153.19.150:88" |
| | | //serverUrl:"res.abeim.cn" |
| | | } |
| | |
| | | import {createRouter, createWebHashHistory} from 'vue-router' |
| | | |
| | | |
| | | // import User from '../views/sys/User.vue' |
| | | // import Role from '../views/sys/Role.vue' |
| | | // import Menu from '../views/sys/Menu.vue' |
| | | |
| | | const router = createRouter({ |
| | | history: createWebHashHistory(), |
| | | routes: [ |
| | |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 系统管理 ----------------*/ |
| | | { |
| | | path: 'User', |
| | | name: 'user', |
| | | component: () => import('../views/user/user.vue'), |
| | | children:[ |
| | | { |
| | | path: '/User/userlist', |
| | | name: 'userlist', |
| | | component: () => import('../views/User/userlist.vue') |
| | | }, |
| | | { |
| | | path: '/User/permissions', |
| | | name: 'permissions', |
| | | component: () => import('../views/User/permissions.vue') |
| | | }, |
| | | { |
| | | path: '/User/rolelist', |
| | | name: 'rolelist', |
| | | component: () => import('../views/User/rolelist.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | /*----------- 用户列表 ----------------*/ |
| | | // { |
| | | // path: 'User', |
| | | // name: 'User', |
| | | // component: () => import('../views/User/userlist.vue'), |
| | | // children:[ |
| | | // { |
| | | // path: '/User/userlist', |
| | | // name: 'userlist', |
| | | // component: () => import('../views/User/userlist.vue') |
| | | // }, |
| | | // ] |
| | | // }, |
| | | |
| | | /*----------- 权限列表 ----------------*/ |
| | | // { |
| | |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | |
| | | /*----------- 可视化系统 ----------------*/ |
| | | { |
| | | path: 'Visualization', |
| | |
| | | component: () => import('../views/Visualization/screenthree.vue') |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 管理系统 ----------------*/ |
| | | { |
| | | path: 'sys', |
| | | name: 'screen', |
| | | component: () => import('../views/Visualization/screen.vue'), |
| | | children: [ |
| | | // { |
| | | // path: '/sys/users', |
| | | // name: 'SysUser', |
| | | // component: User |
| | | // }, |
| | | // { |
| | | // path: '/sys/roles', |
| | | // name: 'SysRole', |
| | | // component: Role |
| | | // }, |
| | | // { |
| | | // path: '/sys/menus', |
| | | // name: 'SysMenu', |
| | | // component: Menu |
| | | // }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '', |
| | | redirect:'/Slicecage/slicecage' |
| | | redirect: '/Slicecage/slicecage' |
| | | } |
| | | ] |
| | | }, |
| | |
| | | |
| | | ] |
| | | }) |
| | | |
| | | export default router |
| | | |
| | | export default router |
| | |
| | | const slot = ref('') |
| | | |
| | | |
| | | request.post("/cacheGlass/edgStorageCage/selectEdgStorageCage").then((res) => { |
| | | request.get("/unLoadGlass/downStorage/selectStorageCage").then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | console.log(res.data); |
| | |
| | | |
| | | <script setup> |
| | | import Swal from 'sweetalert2' |
| | | |
| | | import request from "@/utils/request"; |
| | | const racks = [ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } }, |
| | | { x: 50, y: 270, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 20, width: 10, fillColor: 'yellow', content: 'NG1234567' } }, |
| | | |
| | | { x: 280, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 30, width: 20, fillColor: 'yellow', content: 'NG12345678' } }, |
| | | { x: 280, y: 270, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 35, width: 23, fillColor: 'yellow', content: 'NG123456910' } }, |
| | | |
| | | { x: 140, y: 420, height: 60, width: 110, fillColor: '#6a6da9', item: { height: 30, width: 100, fillColor: 'yellow', content: 'NG1234561454' } } |
| | | |
| | | ]; |
| | | |
| | | |
| | | const calculateItemXPosition = (rack, item, index) => { |
| | | if (index === 0 || index === 1) { |
| | | if (index === 0 ) { |
| | | return rack.x; |
| | | } else if (index === 2 || index === 3) { |
| | | } else if (index === 1 ) { |
| | | return rack.x + rack.width - item.width; |
| | | } else { |
| | | return rack.x + (rack.width - item.width) / 2; |
| | |
| | | }; |
| | | |
| | | const calculateItemYPosition = (rack, item, index) => { |
| | | if (index === 0 || index === 1) { |
| | | if (index === 0 ) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else if (index === 2 || index === 3) { |
| | | } else if (index === 1) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else { |
| | | return rack.y + rack.height - item.height; |
| | | } |
| | | }; |
| | | |
| | | |
| | | const fetchFlowCardId = async () => { |
| | | try { |
| | | const response = await request.get('unLoadGlass/downWorkStation/getwo'); |
| | | console.log(response) |
| | | if (response.code === 200) { |
| | | console.log(response.data); |
| | | // 遍历响应数据并替换racks数组中的item属性 |
| | | response.data.forEach((itemData, index) => { |
| | | if (index < racks.length) { |
| | | const rack = racks[index]; |
| | | const newItem = { |
| | | content: itemData.item.content, |
| | | fillColor: itemData.item.fillColor, |
| | | width: itemData.item.width/10000, |
| | | height: itemData.item.height/10000 |
| | | }; |
| | | rack.item == newItem; |
| | | |
| | | } |
| | | }); |
| | | |
| | | console.log(racks); // 查看更新后的racks数组 |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | } |
| | | }; |
| | | |
| | | fetchFlowCardId() |
| | | // setTimeout(fetchFlowCardId(),1000); |
| | | |
| | | |
| | | |
| | | const showCustomAlert = (content) => { |
| | | var str="架号 : 111\n" + |
| | | "长 : 111\n" + |
| | |
| | | :height="rack.item.height" |
| | | :fill="rack.item.fillColor" |
| | | /> |
| | | <text :x="rack.x + rack.width / 2" :y="rack.y - 10" text-anchor="middle">{{ index + 6 }}号工位</text> |
| | | <text :x="rack.x + rack.width / 2" :y="rack.y - 10" text-anchor="middle">{{ index + 4 }}号工位</text> |
| | | <text :x="rack.x + rack.width / 2" :y="rack.y + rack.height + 20" text-anchor="middle">{{ rack.item.content }}</text> |
| | | </g> |
| | | </g> |
| | |
| | | <script setup> |
| | | import Swal from 'sweetalert2' |
| | | |
| | | const racks = [ |
| | | let racks = [ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } }, |
| | | { x: 50, y: 270, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 20, width: 10, fillColor: 'yellow', content: 'NG1234567' } }, |
| | | { x: 280, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 30, width: 20, fillColor: 'yellow', content: 'NG12345678' } }, |
| | | { x: 280, y: 270, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 35, width: 23, fillColor: 'yellow', content: 'NG123456910' } }, |
| | | { x: 140, y: 420, height: 60, width: 110, fillColor: '#6a6da9', item: { height: 30, width: 100, fillColor: 'yellow', content: 'NG1234561454' } } |
| | | ]; |
| | | |
| | | // 计算元素位置的函数 |
| | | const calculateItemXPosition = (rack, item, index) => { |
| | | if (index === 0 || index === 1) { |
| | | if (index === 0) { |
| | | return rack.x; |
| | | } else if (index === 2 || index === 3) { |
| | | } else if (index === 1) { |
| | | return rack.x + rack.width - item.width; |
| | | } else { |
| | | return rack.x + (rack.width - item.width) / 2; |
| | |
| | | }; |
| | | |
| | | const calculateItemYPosition = (rack, item, index) => { |
| | | if (index === 0 || index === 1) { |
| | | if (index === 0) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else if (index === 2 || index === 3) { |
| | | } else if (index === 1) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else { |
| | | return rack.y + rack.height - item.height; |
| | |
| | | import Landingindication from "./Landingindication.vue"; |
| | | import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import request from "@/utils/request"; |
| | | |
| | | const dialogFormVisiblea = ref(false) |
| | | |
| | | |
| | |
| | | const response = await request.get('unLoadGlass/downWorkStation/getflowCardId'); |
| | | console.log(response) |
| | | if (response.code === 200) { |
| | | flowCardOptions.value = response.data.map(item => ({ flowcard_id: item.flow_card_id })); |
| | | flowCardOptions.value = response.data.map(item => ({ flowcard_id: item.flow_card_Id })); |
| | | console.log(flowCardOptions.value) |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | console.log('绑定成功'); |
| | | |
| | | ElMessage.success(response.message); |
| | | updatePageData(); |
| | | dialogFormVisiblea.value = false; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | |
| | | |
| | | const updatePageData = () => { |
| | | // 假设你的页面上有一个名为 tableData 的 Vue 组件 |
| | | // 你可以直接更新 tableData 的数据 |
| | | tableData.flowCardId = flowCardId.value; |
| | | |
| | | // 使用 $forceUpdate() 强制更新组件 |
| | | forceUpdate(); |
| | | }; |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | initWebSocket(); |
| | | // initWebSocket(); |
| | | onMounted(fetchTableData); |
| | | // setInterval(fetchTableData, 2000) |
| | | |
| | |
| | | <version>1.4.2</version> |
| | | </dependency> |
| | | |
| | | <!--引入redis,排除lettuce的引用--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>io.lettuce</groupId> |
| | | <artifactId>lettuce-core</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- 引入Jedis客戶端--> |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.microsoft.sqlserver</groupId> |
| | | <artifactId>sqljdbc4</artifactId> |
| | | <version>4.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | //默认角色 |
| | | public static final Long DEFULT_ROLE = 1L; |
| | | |
| | | //A09出片目标位置 |
| | | /** |
| | | * 磨边清洗前 |
| | | */ |
| | | /** |
| | | * A09出片目标位置2001 |
| | | * A10出片目标位置2002 |
| | | */ |
| | | public static final Integer A09_OUT_TARGET_POSITION = 2001; |
| | | //A09出片目标位置 |
| | | public static final Integer A10_OUT_TARGET_POSITION = 2002; |
| | | |
| | | /** |
| | | * 卧式理片笼详情表玻璃状态 |
| | | * 识别后成功状态100 |
| | | * 出片任务101 |
| | | * 拿走200 |
| | | * 破损201 |
| | | */ |
| | | public static final Integer GLASS_STATE_IN = 100; |
| | | public static final Integer GLASS_STATE_OUT = 101; |
| | | public static final Integer GLASS_STATE_TAKE = 200; |
| | | public static final Integer A10_OUT_TARGET_DAMAGE = 201; |
| | | |
| | | /** |
| | | * 卧式理片笼详情表玻璃状态 |
| | | * 进片任务1 |
| | | * 出片任务2 |
| | | */ |
| | | public static final Integer GLASS_CACHE_TYPE_IN = 1; |
| | | public static final Integer GLASS_CACHE_TYPE_OUT = 2; |
| | | |
| | | /** |
| | | * 磨边任务玻璃状态 |
| | | * 进片任务1 |
| | | * 出片任务2 |
| | | */ |
| | | public static final Integer EDG_GLASS_BEFORE = 0; |
| | | public static final Integer EDG_GLASS_START = 1; |
| | | public static final Integer EDG_GLASS_SUCCESS = 2; |
| | | |
| | | } |
File was renamed from hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/engineering/controller/EngineeringController.java |
| | |
| | | |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.impl.EngineeringServiceImpl; |
| | | import com.mes.utils.Result; |
| | | import com.mes.workstation.service.UpWorkstationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
File was renamed from hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/engineering/entity/Engineering.java |
| | |
| | | /** |
| | | * 膜系id |
| | | */ |
| | | private Integer filmsId; |
| | | private String filmsId; |
| | | |
| | | /** |
| | | * 备注 |
New file |
| | |
| | | package com.mes.engineering.entity; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Setter |
| | | @Getter |
| | | public class OptimizeEngineering { |
| | | |
| | | // Getter methods |
| | | // Setter methods |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String projectNo; |
| | | |
| | | /** |
| | | * 工程名 |
| | | */ |
| | | private String projectName; |
| | | |
| | | /** |
| | | * 平均利用率 |
| | | */ |
| | | private Double avgCutPct; |
| | | |
| | | /** |
| | | * 有效利用率 |
| | | */ |
| | | private Double validCutPct; |
| | | |
| | | /** |
| | | * 尾片利用率 |
| | | */ |
| | | private Double lastCutPct; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 小片总数 |
| | | */ |
| | | private Integer glassTotal; |
| | | /** |
| | | * 小片总面积 |
| | | */ |
| | | private Double glassTotalArea; |
| | | /** |
| | | * 计划原片总数 |
| | | */ |
| | | private Integer rawStockQty; |
| | | /** |
| | | * 计划原片总面积 |
| | | */ |
| | | private Double rawStockArea; |
| | | /** |
| | | * 实际原片总数 |
| | | */ |
| | | private Integer actualStockQty; |
| | | /** |
| | | * 实际原片总面积 |
| | | */ |
| | | private Double actualStockArea; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String glassType; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.engineering.service; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-04-22 |
| | | */ |
| | | public interface EngineeringService extends IService<Engineering> { |
| | | |
| | | |
| | | /** |
| | | * 开始/暂停任务 |
| | | * @return boolean |
| | | */ |
| | | boolean changeTask(String projectId, Integer state); |
| | | /** |
| | | * 查询钢化信息 |
| | | * @return List<Engineering> |
| | | */ |
| | | List<Engineering> selectEngineering(String engineeringId); |
| | | /** |
| | | * 保存钢化信息 |
| | | */ |
| | | void saveEngineering(List<Engineering> engineering); |
| | | /** |
| | | * 查询是否有上片任务 |
| | | * @return Engineering |
| | | */ |
| | | Engineering selectInitiate(Integer state); |
| | | } |
New file |
| | |
| | | package com.mes.engineering.service.impl; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.mapper.EngineeringMapper; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-04-22 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engineering> implements EngineeringService { |
| | | |
| | | @Autowired |
| | | OptimizeProjectMapper optimizeProjectMapper; |
| | | //开始/暂停任务 |
| | | @Override |
| | | public boolean changeTask(String projectId, Integer state) { |
| | | //暂停正在进行工程 |
| | | LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | pauseWrapper.set(Engineering::getState,0); |
| | | pauseWrapper.eq(Engineering::getState,1); |
| | | pauseWrapper.update(); |
| | | //使用projectId作为条件开始工程 |
| | | LambdaUpdateChainWrapper<Engineering> wrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | wrapper.set(Engineering::getState,state); |
| | | wrapper.eq(Engineering::getEngineerId,projectId); |
| | | return wrapper.update(); |
| | | } |
| | | |
| | | @Override |
| | | @DS("pp") |
| | | public List<Engineering> selectEngineering(String engineeringId) { |
| | | //查询钢化工程信息 |
| | | List<OptimizeProject> optimizeEngineerings = null; |
| | | if (engineeringId != null) { |
| | | QueryWrapper<OptimizeProject> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("project_no,project_name,avg_cut_pct,valid_cut_pct,last_cut_pct,glass_total,glass_total_area,raw_stock_qty,raw_stock_area,glass_type,remark ") |
| | | .eq("project_no", engineeringId); |
| | | optimizeEngineerings = optimizeProjectMapper.selectList(wrapper); |
| | | |
| | | } |
| | | List<Engineering> resultList=new ArrayList<>(); |
| | | // 遍历查询结果赋值 |
| | | if (optimizeEngineerings != null) { |
| | | for (OptimizeProject map : optimizeEngineerings) { |
| | | // 创建一个新的 OptimizeProject 对象 |
| | | Engineering engineering = new Engineering(); |
| | | // 将 Map 中的每个键值对映射到 OptimizeProject 对象的相应字段上 |
| | | engineering.setEngineerId( map.getProjectNo());//工程id |
| | | engineering.setEngineerName( map.getProjectName());//工程名称 |
| | | engineering.setAvgAvailability( map.getAvgCutPct());//平均优化率 |
| | | engineering.setValidAvailability( map.getValidCutPct());//有效优化率 |
| | | engineering.setLastAvailability( map.getLastCutPct());//尾片优化率 |
| | | engineering.setState(0);//状态 |
| | | engineering.setGlassTotal( map.getGlassTotal());//小片玻璃总数 |
| | | engineering.setGlassTotalArea( map.getGlassTotalArea());//小片总面积 |
| | | engineering.setPlanPatternTotal( map.getRawStockQty());//计划原片总数 |
| | | engineering.setPlanPatternTotalArea( map.getRawStockArea());//计划原片总面积 |
| | | engineering.setFilmsId( map.getGlassType());//膜系 |
| | | engineering.setNotes( map.getRemark());//备注 |
| | | // 将映射后的对象添加到结果列表中 |
| | | resultList.add(engineering); |
| | | } |
| | | } |
| | | log.info("查询出钢化工程集合保存到实体类{}",resultList); |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public void saveEngineering(List<Engineering> engineering) { |
| | | this.saveBatch(engineering); |
| | | //保存钢化工程信息 |
| | | } |
| | | |
| | | @Override |
| | | public Engineering selectInitiate(Integer state) { |
| | | //查询是否有开始上片的工程任务 |
| | | QueryWrapper<Engineering> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state", state); |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | private String glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String projectId; |
| | | private String processId; |
| | | |
| | | /** |
| | | * 工程种类 |
| | |
| | | package com.mes.glassinfo.service; |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import java.util.List; |
| | | |
| | |
| | | * @since 2024-04-29 |
| | | */ |
| | | public interface GlassInfoService extends MPJBaseService<GlassInfo> { |
| | | |
| | | /** |
| | | * 查询小片表 |
| | | * @return List<GlassInfo> |
| | | */ |
| | | List<GlassInfo> selectGlassInfo(String engineeringId); |
| | | /** |
| | | * 保存小片表 |
| | | */ |
| | | void saveGlassInfo(List<GlassInfo> glassinfo); |
| | | } |
| | | |
| | |
| | | import com.mes.glassinfo.entity.OptimizeGlassinfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | OptimizeProjectMapper optimizeProjectMapper; |
| | | @Override |
| | | @DS("pp") |
| | | |
| | | public List<GlassInfo> selectGlassInfo(String engineeringId) { |
| | | List<OptimizeGlassinfo> optimizeGlassinfos=null; |
| | | if (engineeringId != null) { |
| | | optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id") |
| | | .leftJoin("optimize_detail b on t.project_no=b.project_no") |
| | | .eq("t.state",200) |
| | | .eq("t.state",100) |
| | | .eq("t.project_no", engineeringId)); |
| | | } |
| | | |
| | |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | | // 将 Map 中的每个键值对映射到 OptimizeGlassinfo 对象的相应字段上 |
| | | glassInfo.setEngineerId(map.getProjectNo()); |
| | | glassInfo.setFlowCardId(map.getProjectId()); |
| | | glassInfo.setFlowCardId(map.getProcessId()); |
| | | glassInfo.setFilmsid(map.getGlassType()); |
| | | glassInfo.setGlassType(map.getType()); |
| | | glassInfo.setWidth(map.getWidth()); |
| | | glassInfo.setHeight(map.getHeight()); |
| | | glassInfo.setEdgWidth(map.getPWidth()); |
| | | glassInfo.setEdgHeight(map.getPHeight()); |
| | | glassInfo.setThickness(map.getGlassThickness()); |
| | | glassInfo.setPatternSequence(map.getStockId());// |
| | | glassInfo.setTemperingLayoutId(map.getHeatLayoutId());//钢化版图id |
| | |
| | | log.info("查询出glassinfopro的数据{}:",optimizeGlassinfos); |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public void saveGlassInfo(List<GlassInfo> glassinfo) { |
| | | this.saveBatch(glassinfo); |
| | | } |
| | | } |
| | |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @ApiOperation("保存工程信息") |
| | | @PostMapping("/saveProject") //显示工程选择信息 |
| | | public Result<List<OptimizeProject>> saveProject(@RequestBody OptimizeRequest optimizeRequest) { |
| | | log.info("获取选择好的工程id进行查询数据后保存"); |
| | | List<OptimizeProject> glass = optimizeProjectService.selectSaveProject(optimizeRequest); |
| | | log.info("显示工程选择信息后保存到upPattenUsage表:{}", glass); |
| | | optimizeProjectService.insetupPattenUsage(glass); |
| | | //void insetProject(glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | // @ApiOperation("保存工程信息") |
| | | // @PostMapping("/saveProject") //显示工程选择信息 |
| | | // public Result<List<OptimizeProject>> saveProject(@RequestBody OptimizeRequest optimizeRequest) { |
| | | // log.info("获取选择好的工程id进行查询数据后保存"); |
| | | // List<OptimizeProject> glass = optimizeProjectService.selectSaveProject(optimizeRequest); |
| | | // log.info("显示工程选择信息后保存到upPattenUsage表:{}", glass); |
| | | // optimizeProjectService.insetupPattenUsage(glass); |
| | | // //void insetProject(glass); |
| | | // return Result.build(200, "", glass); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | /** |
| | | * 第一次平均切裁率 |
| | | */ |
| | | private String fristCutPct; |
| | | private Double fristCutPct; |
| | | |
| | | /** |
| | | * 使用的原料数 |
| | |
| | | /** |
| | | * 使用的原料面积 |
| | | */ |
| | | private String rawStockArea; |
| | | private Double rawStockArea; |
| | | |
| | | /** |
| | | * 平均切裁率 |
| | | */ |
| | | private String avgCutPct; |
| | | private Double avgCutPct; |
| | | |
| | | /** |
| | | * 有效切裁率 |
| | | */ |
| | | private String validCutPct; |
| | | private Double validCutPct; |
| | | |
| | | /** |
| | | * 尾片切裁率 |
| | | */ |
| | | private String lastCutPct; |
| | | private Double lastCutPct; |
| | | |
| | | /** |
| | | * g混排程度 |
| | |
| | | /** |
| | | * g上片宽 |
| | | */ |
| | | private Float loadWidth; |
| | | private Double loadWidth; |
| | | |
| | | /** |
| | | * g上片长 |
| | | */ |
| | | private Float loadLength; |
| | | private Double loadLength; |
| | | |
| | | /** |
| | | * x间隔 |
| | | */ |
| | | private Float xSpace; |
| | | private Double xSpace; |
| | | |
| | | /** |
| | | * y间隔 |
| | | */ |
| | | private Float ySpace; |
| | | private Double ySpace; |
| | | |
| | | /** |
| | | * g平均装载率 |
| | | */ |
| | | private Float loadRate; |
| | | private Double loadRate; |
| | | |
| | | /** |
| | | * 流程卡集合 |
| | |
| | | package com.mes.pp.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | |
| | | |
| | | /** |
| | | * 查询可领取的任务工程信息 |
| | | * @return |
| | | * @return List<OptimizeProject> |
| | | */ |
| | | List<OptimizeProject> listByState(OptimizeRequest optimizeRequest); |
| | | |
| | | /** |
| | | * 查询保存到原片使用详情表的数据 |
| | | * @return |
| | | * 将工程信息更新状态为已领取 |
| | | */ |
| | | List<OptimizeProject> selectSaveProject(OptimizeRequest optimizeRequest); |
| | | /** |
| | | * 将工程信息保存到原片使用详情表 |
| | | * @return |
| | | */ |
| | | void insetupPattenUsage(List<OptimizeProject> glass); |
| | | void changeTask(String engineeringId, int i); |
| | | } |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | @Override |
| | | public void insetupPattenUsage(List<OptimizeProject> glass) { |
| | | log.info("循环查询结果保存到UpPattenUsage表中"); |
| | | for (OptimizeProject project : glass) { |
| | | UpPattenUsage upPattenUsage = new UpPattenUsage(); |
| | | upPattenUsage.setEngineeringId(project.getProjectNo()); |
| | | upPattenUsage.setFilmsId(project.getGlassType()); |
| | | upPattenUsage.setState(project.getState()); |
| | | upPattenUsageMapper.insert(upPattenUsage); |
| | | } |
| | | public void changeTask(String engineeringId, int state) { |
| | | UpdateWrapper<OptimizeProject> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("project_no",engineeringId) |
| | | .set("state",state); |
| | | boolean updateSuccess = this.update(wrapper); |
| | | log.info("工程表更新状态{}",updateSuccess); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<OptimizeProject> selectSaveProject(OptimizeRequest optimizeRequest) { |
| | | log.info("将参数传入到查询类里,工程号做非空判断模糊查询"); |
| | | |
| | | log.info("返回工程信息"); |
| | | return this.baseMapper.saveProject(optimizeRequest); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | // |
| | | //import com.mes.uppattenusage.service.GlassInfoService; |
| | | //import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; |
| | | //import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | //import com.mes.glassinfo.entity.GlassInfo; |
| | | //import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | //import com.mes.utils.Result; |
| | | //import io.swagger.annotations.ApiOperation; |
| | | //import lombok.extern.slf4j.Slf4j; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.web.bind.annotation.GetMapping; |
| | | //import org.springframework.web.bind.annotation.RequestBody; |
| | | //import org.springframework.web.bind.annotation.RequestMapping; |
| | | //import org.springframework.web.bind.annotation.RestController; |
| | | // |
| | | //import java.util.List; |
| | | // |
| | | ///** |
| | | // * <p> |
| | | // * 前端控制器 |
| | | // * </p> |
| | | // * |
| | | // * @author zhoush |
| | | // * @since 2024-04-18 |
| | | // */ |
| | | //@RestController |
| | | //@RequestMapping("/up-patten-usage") |
| | | //@Slf4j |
| | | //public class UpPattenUsageController { |
| | | // |
| | | // @Autowired |
| | | // private UpPattenUsageService upPattenUsageService; |
| | | // @Autowired |
| | | // private GlassInfoService glassInfoService; |
| | | // @ApiOperation("显示正在出片的工程信息") |
| | | // @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 |
| | | // public Result<List<UpPattenUsage>> prioritylist() { |
| | | // List<UpPattenUsage> glass = upPattenUsageService.prioritylist(1); |
| | | // log.info("显示工位上的玻璃信息:{}", glass); |
| | | // return Result.build(200, "", glass); |
| | | // } |
| | | // |
| | | // @ApiOperation("点击选择工程保存后进行调用,传入工程号") |
| | | // @GetMapping("/saveUpPattenUsage") //查询现在上片机的玻璃信息 |
| | | // public Result<Integer> saveUpPattenUsage(String engineeringId) { |
| | | // List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineeringId); |
| | | // log.info("将查询出的UpPattenUsage数据保存到数据库表里"); |
| | | // upPattenUsageService.saveUpPattenUsage(upPattenUsages); |
| | | // log.info("从PP表查询glassinfo的数据并保存到表里"); |
| | | // List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineeringId); |
| | | // return Result.build(200, "", 200); |
| | | // } |
| | | //} |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/up-patten-usage") |
| | | @Slf4j |
| | | public class UpPattenUsageController { |
| | | |
| | | @Autowired |
| | | private UpPattenUsageService upPattenUsageService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @ApiOperation("显示正在出片的工程信息") |
| | | @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 |
| | | public Result<List<UpPattenUsage>> prioritylist() { |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(1); |
| | | log.info("显示工位上的玻璃信息:{}", glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @ApiOperation("点击选择工程保存后进行调用,传入工程号") |
| | | @GetMapping("/saveUpPattenUsage") //查询现在上片机的玻璃信息 |
| | | public Result<Integer> saveUpPattenUsage(String engineeringId) { |
| | | log.info("传入工程号判断是否已保存:{}", engineeringId); |
| | | UpPattenUsage upPattenUsage= upPattenUsageService.selectedEngineering(engineeringId); |
| | | if (upPattenUsage!=null){ |
| | | log.info("已保存过"); |
| | | return Result.build(200, "已保存的工程", 200); |
| | | }else { |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineeringId); |
| | | log.info("将查询出的UpPattenUsage数据保存到数据库表里"); |
| | | upPattenUsageService.saveUpPattenUsage(upPattenUsages); |
| | | log.info("从PP表查询glassinfo的数据并保存到表里"); |
| | | List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineeringId); |
| | | glassInfoService.saveGlassInfo(glassinfo); |
| | | log.info("从PP表查询engineering的数据并保存到表里"); |
| | | List<Engineering> engineering= engineeringService.selectEngineering(engineeringId); |
| | | engineeringService.saveEngineering(engineering); |
| | | log.info("更改pp表状态为已领取"); |
| | | optimizeProjectService.changeTask(engineeringId, 200); |
| | | return Result.build(200, "", 200); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * 原片版图片序 |
| | | */ |
| | | private Integer heatLayoutSort; |
| | | private Integer stockId; |
| | | |
| | | /** |
| | | * 状态 |
| | |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-04-18 |
| | | */ |
| | | public interface UpPattenUsageService extends MPJBaseService<UpPattenUsage> { |
| | | /** |
| | | * 查询工位上的玻璃信息 |
| | | * @return List<UpPattenUsage> |
| | | */ |
| | | List<UpPattenUsage> prioritylist(int state); |
| | | |
| | | /** |
| | | * 查询上片顺序信息 |
| | | * @return List<UpPattenUsage> |
| | | */ |
| | | List<UpPattenUsage> selectSaveUpPattenUsage(String engineeringId); |
| | | |
| | | /** |
| | | * 保存上片顺序信息 |
| | | */ |
| | | void saveUpPattenUsage(List<UpPattenUsage> upPattenUsages); |
| | | /** |
| | | * 更新上片表状态 |
| | | */ |
| | | void updateUpPattenUsageState(UpPattenUsage upPattenUsage, Integer state); |
| | | /** |
| | | * 判断此工程是否已保存过 |
| | | * @return UpPattenUsage |
| | | */ |
| | | UpPattenUsage selectedEngineering(String engineeringId); |
| | | /** |
| | | * 查询正在执行的上片任务 |
| | | * @return UpPattenUsage |
| | | */ |
| | | UpPattenUsage selectOverTask(); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | 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.MPJQueryWrapper; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | |
| | | List<OptimizeUpPattenUsage> upPattenUsageList = null; |
| | | if (engineeringId != null) { |
| | | upPattenUsageList = optimizeProjectMapper.selectJoinList(OptimizeUpPattenUsage.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("t.project_no,t.glass_type,b.width,b.height,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.heat_layout_sort") |
| | | .select("t.project_no,t.glass_type,b.width,b.height,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id") |
| | | .leftJoin("optimize_layout b on t.project_no=b.project_no") |
| | | .eq("b.project_no", engineeringId)); |
| | | } |
| | |
| | | // 创建一个新的 OptimizeProject 对象 |
| | | UpPattenUsage optimizeProject = new UpPattenUsage(); |
| | | // 将 Map 中的每个键值对映射到 OptimizeProject 对象的相应字段上 |
| | | optimizeProject.setEngineeringId((String) map.getProjectNo()); |
| | | optimizeProject.setFilmsId((String) map.getGlassType()); |
| | | optimizeProject.setWidth((Double) map.getWidth()); |
| | | optimizeProject.setHeight((Double) map.getHeight()); |
| | | optimizeProject.setThickness((Double)map.getHeight()); |
| | | optimizeProject.setLayoutSequence((Integer) map.getHeatLayoutSort()); |
| | | optimizeProject.setEngineeringId(map.getProjectNo()); |
| | | optimizeProject.setFilmsId( map.getGlassType()); |
| | | optimizeProject.setWidth(map.getWidth()); |
| | | optimizeProject.setHeight( map.getHeight()); |
| | | optimizeProject.setThickness(map.getGlassThickness()); |
| | | optimizeProject.setLayoutSequence( map.getStockId()); |
| | | optimizeProject.setState(0); |
| | | // 将映射后的对象添加到结果列表中 |
| | | resultList.add(optimizeProject); |
| | |
| | | //保存原片使用详情表 |
| | | } |
| | | |
| | | //@Override |
| | | public void selectSaveGlassinfo(String engineeringId) { |
| | | //保存玻璃信息表 |
| | | //optimizeProjectMapper.selectJoinList(); |
| | | @Override |
| | | public void updateUpPattenUsageState(UpPattenUsage upPattenUsage, Integer state) { |
| | | upPattenUsage.setState(state); |
| | | boolean updateSuccess=this.updateById(upPattenUsage); |
| | | log.info("更新状态{}",updateSuccess); |
| | | //更新状态 |
| | | } |
| | | |
| | | @Override |
| | | public UpPattenUsage selectedEngineering(String engineeringId) { |
| | | QueryWrapper<UpPattenUsage>wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("engineering_id",engineeringId) |
| | | .last("limit 1"); |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public UpPattenUsage selectOverTask() { |
| | | QueryWrapper<UpPattenUsage>wrapper = new QueryWrapper<>(); |
| | | wrapper.gt("state",0) |
| | | .lt("state",99) |
| | | .last("limit 1"); |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | |
| | |
| | | .antMatchers("/webjars/**").permitAll() |
| | | .antMatchers("/v2/**").permitAll() |
| | | .antMatchers("/swagger-resources/**").permitAll() |
| | | .antMatchers("/**").permitAll() |
| | | .anyRequest().authenticated() |
| | | |
| | | // 异常处理器 |
| | |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | // SpringApplication springApplication = new SpringApplication(CacheGlassModuleApplication.class); |
| | | // ConfigurableApplicationContext applicationContext = springApplication.run(args); |
| | | // WebSocketServer.setApplicationContext(applicationContext); |
| | | SpringApplication.run(CacheGlassModuleApplication.class, args); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
New file |
| | |
| | | package com.mes.edgglasstask.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-05-11 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/edgGlassTaskInfo") |
| | | public class EdgGlassTaskInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.edgglasstask.entity; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-05-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class EdgGlassTaskInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String glassId; |
| | | |
| | | private Integer width; |
| | | |
| | | private Integer height; |
| | | |
| | | private Integer thickness; |
| | | |
| | | private Integer glassType; |
| | | |
| | | private Integer status; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgglasstask.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-05-11 |
| | | */ |
| | | @DS("salve_hangzhoumes") |
| | | public interface EdgGlassTaskInfoMapper extends BaseMapper<EdgGlassTaskInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgglasstask.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-05-11 |
| | | */ |
| | | public interface EdgGlassTaskInfoService extends IService<EdgGlassTaskInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgglasstask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.mapper.EdgGlassTaskInfoMapper; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-05-11 |
| | | */ |
| | | @Service |
| | | public class EdgGlassTaskInfoServiceImpl extends ServiceImpl<EdgGlassTaskInfoMapper, EdgGlassTaskInfo> implements EdgGlassTaskInfoService { |
| | | |
| | | } |
| | |
| | | package com.mes.edgstoragecage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | * 状态 (识别后成功状态100,出片任务101, 拿走200,破损201) |
| | | */ |
| | | private Integer state; |
| | | |
| | |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer count; |
| | | |
| | | |
| | | } |
| | |
| | | /** |
| | | * 查询笼内版图差值范围内的 此尺寸玻璃 如无则按照 钢化版图序号 以及玻璃序号 |
| | | * @param glassId |
| | | * @param poor |
| | | * @param threshold |
| | | * @return |
| | | */ |
| | | EdgStorageCageDetails selectConformGlass(String glassId, int poor); |
| | | EdgStorageCageDetails selectConformGlass(String glassId, int threshold); |
| | | |
| | | /** |
| | | * 获取出片信息数据 |
| | | * @param glassId |
| | | * @param poor |
| | | * @param threshold |
| | | * @return |
| | | */ |
| | | EdgStorageCageDetails selectOutGlass(String glassId, int poor); |
| | | EdgStorageCageDetails selectOutGlass(String glassId, int threshold); |
| | | } |
| | |
| | | package com.mes.edgstoragecage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | |
| | | public interface EdgStorageCageService extends MPJBaseService<EdgStorageCage> { |
| | | |
| | | /** |
| | | * 查询笼内离指定格子最近空格 |
| | | * @return |
| | | */ |
| | | EdgStorageCage selectNearestEmpty(int currentSlot); |
| | | |
| | | /** |
| | | * 查询笼内空格 |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询笼内版图差值范围内的 此尺寸玻璃 如无则按照 钢化版图序号 以及玻璃序号 |
| | | * |
| | | * @param glassId |
| | | * @param poor |
| | | * @param threshold |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EdgStorageCageDetails selectConformGlass(String glassId, int poor){ |
| | | public EdgStorageCageDetails selectConformGlass(String glassId, int threshold) { |
| | | //1.去笼内查询此尺寸的玻璃 目前版图差值内的玻璃 是否有同尺寸的 |
| | | //1.1 有同尺寸的 则生成同尺寸的任务 |
| | | //1.2 无同尺寸的 则生成版图顺序最小的出片 |
| | | EdgStorageCageDetails edgStorageCageDetails= baseMapper.selectOne(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | EdgStorageCageDetails edgStorageCageDetails = baseMapper.selectOne(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getGlassId,glassId) |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId) |
| | | ); |
| | | List<EdgStorageCageDetails> listEdgStorageCageDetails= baseMapper.selectList(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .lt(EdgStorageCageDetails::getState,200) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId,EdgStorageCageDetails::getTemperingFeedSequence) |
| | | 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 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>() |
| | | 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)) |
| | | .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) |
| | | .eq(EdgStorageCageDetails::getWidth, edgStorageCageDetails.getWidth()) |
| | | .eq(EdgStorageCageDetails::getHeight, edgStorageCageDetails.getHeight()) |
| | | .ge(EdgStorageCageDetails::getTemperingLayoutId, minTemperingLayoutId.getTemperingLayoutId()) |
| | | .le(EdgStorageCageDetails::getTemperingLayoutId, minTemperingLayoutId.getTemperingLayoutId() + threshold) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | ); |
| | | } |
| | | |
| | | if (result==null){ |
| | | result=edgStorageCageMapper.selectJoinOne(EdgStorageCageDetails.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | 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)) |
| | | .leftJoin(EdgStorageCageDetails.class, on -> on |
| | | .eq(EdgStorageCageDetails::getDeviceId, EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot)) |
| | | .isNotNull(EdgStorageCageDetails::getSlot) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId,EdgStorageCageDetails::getTemperingFeedSequence) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | ); |
| | | } |
| | | return result; |
| | |
| | | * 查询笼内版图差值范围内的 此尺寸玻璃 如无则按照 钢化版图序号 以及玻璃序号 |
| | | * |
| | | * @param glassId |
| | | * @param poor |
| | | * @param threshold |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EdgStorageCageDetails selectOutGlass(String glassId, int poor) { |
| | | public EdgStorageCageDetails selectOutGlass(String glassId, int threshold) { |
| | | EdgStorageCageDetails oldEdgStorageCageDetails = null; |
| | | if (StringUtils.isNotEmpty(glassId)) { |
| | | oldEdgStorageCageDetails = baseMapper.selectOne(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | |
| | | |
| | | EdgStorageCageDetails outEdgStorageCageDetails = null; |
| | | |
| | | //todo:获取笼子内最大版图id和最小版图id插值,判断是否大于阈值,大于阈值直接出最小版图玻璃 |
| | | //todo:逻辑1:获取两条线已出最后一块玻璃在笼内相同尺寸所剩数量,优先走数量少的线 |
| | | //todo:逻辑2:优先走空闲的线 |
| | | //todo:需要在卧式理片笼详情表中新增状态,用来表示玻璃进出理片笼情况 |
| | | if (oldEdgStorageCageDetails != null && minTemperingLayoutId != null) { |
| | | log.info("按照上一片已出玻璃宽度{},高度{},及版图id区间{}到{}获取出片任务玻璃信息", oldEdgStorageCageDetails.getWidth() |
| | | , oldEdgStorageCageDetails.getHeight(), minTemperingLayoutId.getTemperingLayoutId(), minTemperingLayoutId.getTemperingLayoutId() + poor); |
| | | outEdgStorageCageDetails = this.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .notIn(CollectionUtils.isNotEmpty(glassIds), EdgStorageCageDetails::getGlassId, glassIds) |
| | | .eq(EdgStorageCageDetails::getWidth, oldEdgStorageCageDetails.getWidth()) |
| | | .eq(EdgStorageCageDetails::getHeight, oldEdgStorageCageDetails.getHeight()) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | .last("limit 1")); |
| | | log.info("出片任务的玻璃信息:{}", outEdgStorageCageDetails); |
| | | } |
| | | // if (queryMaxMinDiff(threshold)) |
| | | //todo:逻辑1:获取两条线已出最后一块玻璃在笼内相同尺寸所剩数量,优先走数量少的线 |
| | | //todo:需要在卧式理片笼详情表中新增状态,用来表示玻璃进出理片笼情况 |
| | | if (oldEdgStorageCageDetails != null && minTemperingLayoutId != null) { |
| | | log.info("按照上一片已出玻璃宽度{},高度{},及版图id区间{}到{}获取出片任务玻璃信息", oldEdgStorageCageDetails.getWidth() |
| | | , oldEdgStorageCageDetails.getHeight(), minTemperingLayoutId.getTemperingLayoutId(), minTemperingLayoutId.getTemperingLayoutId() + threshold); |
| | | outEdgStorageCageDetails = this.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .notIn(CollectionUtils.isNotEmpty(glassIds), EdgStorageCageDetails::getGlassId, glassIds) |
| | | .eq(EdgStorageCageDetails::getWidth, oldEdgStorageCageDetails.getWidth()) |
| | | .eq(EdgStorageCageDetails::getHeight, oldEdgStorageCageDetails.getHeight()) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | .last("limit 1")); |
| | | log.info("出片任务的玻璃信息:{}", outEdgStorageCageDetails); |
| | | } |
| | | if (outEdgStorageCageDetails == null) { |
| | | outEdgStorageCageDetails = minTemperingLayoutId; |
| | | } |
| | | return outEdgStorageCageDetails; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | |
| | | @Autowired |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | |
| | | @Override |
| | | public EdgStorageCage selectNearestEmpty(int currentSlot) { |
| | | return this.selectJoinOne(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCage.class) |
| | | .leftJoin(EdgStorageCageDetails.class, on -> on |
| | | .eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)) |
| | | .isNull(EdgStorageCageDetails::getSlot) |
| | | .last("order by abs(t.slot - " + currentSlot + ") asc limit 1") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 查询笼内空格 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EdgStorageCage> selectCacheEmpty(){ |
| | | return baseMapper.selectJoinList(EdgStorageCage.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | public List<EdgStorageCage> selectCacheEmpty() { |
| | | return baseMapper.selectJoinList(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCage.class) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot) |
| | | .eq(EdgStorageCageDetails::getState,"100")) |
| | | .leftJoin(EdgStorageCageDetails.class, on -> on |
| | | .eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot) |
| | | .eq(EdgStorageCageDetails::getState, "100")) |
| | | .isNull(EdgStorageCageDetails::getSlot) |
| | | .last("order by abs(t.slot - 4) asc") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 查询笼内出片任务 按钢化版图号+版图内序号 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectCacheOut(){ |
| | | public List<Map<String, Object>> selectCacheOut() { |
| | | |
| | | return upPattenUsageMapper.selectJoinMaps(JoinWrappers.lambda(UpPattenUsage.class).selectAll(UpPattenUsage.class) |
| | | .select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight,EdgStorageCageDetails::getGlassId) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | .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 upPattenUsageMapper.selectJoinMaps(new MPJQueryWrapper<UpPattenUsage>().selectAll(UpPattenUsage.class) |
| | |
| | | |
| | | /** |
| | | * 理片缓存详情 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectEdgStorageCages(){ |
| | | public List<Map<String, Object>> selectEdgStorageCages() { |
| | | return baseMapper.selectJoinMaps(JoinWrappers.lambda(EdgStorageCage.class) |
| | | .selectAll(EdgStorageCage.class) |
| | | .selectAs(EdgStorageCageDetails::getId,"esdId") |
| | | .select(EdgStorageCageDetails::getGlassId,EdgStorageCageDetails::getWidth,EdgStorageCageDetails::getHeight,EdgStorageCageDetails::getId) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | .selectAs(EdgStorageCageDetails::getId, "esdId") |
| | | .select(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight, EdgStorageCageDetails::getId) |
| | | .leftJoin(EdgStorageCageDetails.class, on -> on |
| | | .eq(EdgStorageCageDetails::getDeviceId, EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot)) |
| | | ); |
| | | // return baseMapper.selectJoinMaps(new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class) |
| | | // .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | |
| | | |
| | | /** |
| | | * 修改理片笼信息 功能:对笼内栅格玻璃 【启用/禁用】 |
| | | * |
| | | * @param edgStorageCage |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateEdgStorageCage(EdgStorageCage edgStorageCage){ |
| | | EdgStorageCage edgItem=baseMapper.selectById(edgStorageCage.getId()); |
| | | public boolean updateEdgStorageCage(EdgStorageCage edgStorageCage) { |
| | | EdgStorageCage edgItem = baseMapper.selectById(edgStorageCage.getId()); |
| | | edgItem.setEnableState(edgStorageCage.getEnableState()); |
| | | baseMapper.updateById(edgItem); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | *修改理片笼信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | * 修改理片笼信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | * |
| | | * @param edgStorageCageId |
| | | * @param edgStorageCageDetails |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateEdgStorageCageDetails(int edgStorageCageId,EdgStorageCageDetails edgStorageCageDetails){ |
| | | EdgStorageCage edgItem=baseMapper.selectById(edgStorageCageId); |
| | | log.info("正常"+edgItem); |
| | | EdgStorageCageDetails edgDItem=edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | if (edgItem!=null){ |
| | | public boolean updateEdgStorageCageDetails(int edgStorageCageId, EdgStorageCageDetails edgStorageCageDetails) { |
| | | EdgStorageCage edgItem = baseMapper.selectById(edgStorageCageId); |
| | | log.info("正常" + edgItem); |
| | | EdgStorageCageDetails edgDItem = edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | if (edgItem != null) { |
| | | //移除 |
| | | EdgStorageCageDetails result=edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot,edgStorageCageId)); |
| | | if (result!=null){ |
| | | EdgStorageCageDetails result = edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot, edgStorageCageId)); |
| | | if (result != null) { |
| | | result.setSlot(0); |
| | | edgStorageCageDetailsMapper.updateById(result); |
| | | } |
| | | //添加 |
| | | if(edgDItem!=null){ |
| | | if (edgDItem != null) { |
| | | //只传格子 :移除玻璃 |
| | | EdgStorageCageDetails newresult=edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | EdgStorageCageDetails newresult = edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | newresult.setSlot(edgItem.getSlot()); |
| | | edgStorageCageDetailsMapper.updateById(newresult); |
| | | } |
| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | EdgStorageCageDetailsService edgStorageCageDetailsService; |
| | | |
| | | @Autowired |
| | | EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | @Value("${mes.threshold}") |
| | | private int threshold; |
| | | |
| | | @Scheduled(fixedDelay = 10000) |
| | | @Value("${mes.ratio}") |
| | | private int ratio; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | |
| | | String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue(); |
| | | String glassIdeValue = plcParameterObject.getPlcParameter("A05_scanning_ID").getValue(); |
| | | String confirmationWrodValue = plcParameterObject.getPlcParameter("MES_confirmation_word").getValue(); |
| | | // 1为A09空闲,2为A10空闲,3为A09A10都空闲,0为A09A10都有玻璃 |
| | | String outGlassstate = plcParameterObject.getPlcParameter("A09_glass_status").getValue(); |
| | | |
| | | //A08 A09表示线路相同 可做等价 无数据转int异常 |
| | | String out08Glassstate = plcParameterObject.getPlcParameter("A08_glass_status").getValue(); |
| | | String out10Glassstate = plcParameterObject.getPlcParameter("A10_glass_status").getValue(); |
| | | String confirmationWrodAddress = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress(); |
| | | String currentSlot = plcParameterObject.getPlcParameter("Current_slot").getValue(); |
| | | |
| | | // String taskRequestTypeValue = "2"; |
| | | // String glassIdeValue = "2222222222"; |
| | | // String confirmationWrodValue = "0"; |
| | | // //A08 A09表示线路相同 可做等价 |
| | | // Integer out08Glassstate = 1; |
| | | // Integer out10Glassstate = 0; |
| | | // String confirmationWrodAddress = "DB11.38"; |
| | | // String currentSlot = "1"; |
| | | |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:A09:{}、A10:{},当前格子号为:{}", |
| | | taskRequestTypeValue, glassIdeValue, confirmationWrodValue, out08Glassstate, out10Glassstate, currentSlot); |
| | | |
| | | if ("0".equals(taskRequestTypeValue)) { |
| | | log.info("1、获取到的请求字为0,将确认字改为0"); |
| | | if ("0".equals(confirmationWrodValue)) { |
| | | log.info("2、获取到的请求字为0,且确认字为0,不执行任务"); |
| | | return; |
| | | } |
| | | log.info("2、获取到的请求字为0,将确认字改为0"); |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 0); |
| | | return; |
| | | } |
| | | if (!"0".equals(confirmationWrodValue)) { |
| | | log.info("1、获取到的请求字不为0,将确认字改为0"); |
| | | log.info("2、获取到的请求字不为0,将确认字改为0"); |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 0); |
| | | return; |
| | | } |
| | | if ("1".equals(taskRequestTypeValue)) { |
| | | log.info("2、进片请求,且确认字为0,执行进片任务"); |
| | | inTo(glassIdeValue, confirmationWrodAddress); |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } else if ("2".equals(taskRequestTypeValue)) { |
| | | //09空闲 :1 10空闲 :2 都空闲:3 其他0 |
| | | log.info("2、出片请求,且确认字为0,执行进片任务"); |
| | | outTo(Integer.parseInt(outGlassstate), confirmationWrodAddress); |
| | | outTo(Integer.parseInt(out08Glassstate), |
| | | Integer.parseInt(out10Glassstate), confirmationWrodAddress); |
| | | } else if ("3".equals(taskRequestTypeValue)) { |
| | | log.info("2、进片和出片都空闲,执行出片任务"); |
| | | if ("0".equals(outGlassstate)) { |
| | | inTo(glassIdeValue, confirmationWrodAddress); |
| | | //加笼子里面是否有玻璃,有先出,无玻璃先进 |
| | | int count = edgStorageCageDetailsService.count(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | if (("1".equals(out08Glassstate) || "1".equals(out10Glassstate)) && count > 0) { |
| | | boolean outFlase = outTo(Integer.parseInt(out08Glassstate), |
| | | Integer.parseInt(out10Glassstate), confirmationWrodAddress); |
| | | log.info("出片任务是否完成:{},失败且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue); |
| | | if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) { |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } |
| | | } else { |
| | | outTo(Integer.parseInt(outGlassstate), confirmationWrodAddress); |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void inTo(String glassId, String confirmationWrodAddress) { |
| | | log.info("1、按照玻璃id:{}获取玻璃小片信息", glassId); |
| | | /** |
| | | * 进片任务 |
| | | * |
| | | * @param glassId |
| | | * @param confirmationWrodAddress |
| | | * @param currentSlot |
| | | */ |
| | | private void inTo(String glassId, String confirmationWrodAddress, String currentSlot) { |
| | | log.info("1、按照玻璃id:{}获取玻璃小片信息,当前格子为:{}", glassId, currentSlot); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | if (glassInfo == null) { |
| | | log.info("2、此玻璃编号不存在"); |
| | |
| | | } |
| | | log.info("2、获取到的玻璃信息为{}", glassInfo); |
| | | //添加进片任务 查找空格 |
| | | List<EdgStorageCage> list = edgStorageCageService.selectCacheEmpty(); |
| | | log.info("3、查询卧式理片笼里面的空格:{}", list); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | log.info("4、不存在空格"); |
| | | return; |
| | | } |
| | | log.info("4、将玻璃信息插入卧式理片笼:{}", glassInfo); |
| | | EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot)); |
| | | Assert.isTrue(null != nearestEmpty, "格子已满"); |
| | | log.info("3、查询卧式理片笼里面的空格:{}", nearestEmpty); |
| | | |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | EdgStorageCageDetails details = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(100); |
| | | Integer slot = list.get(0).getSlot(); |
| | | Integer deviceId = list.get(0).getDeviceId(); |
| | | log.info("5、获取空闲格子为:{},设备号为{}", slot, deviceId); |
| | | details.setSlot(slot); |
| | | details.setDeviceId(deviceId); |
| | | details.setState(Const.GLASS_STATE_IN); |
| | | details.setSlot(nearestEmpty.getSlot()); |
| | | details.setDeviceId(nearestEmpty.getDeviceId()); |
| | | edgStorageCageDetailsService.save(details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | //添加进片任务 |
| | | boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | log.info("6、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | |
| | | log.info("6、生成进片任务信息存入任务表"); |
| | | TaskCache taskCache = new TaskCache(); |
| | | taskCache.setGlassId(glassId); |
| | | taskCache.setTaskStatus(0); |
| | | taskCache.setStartCell(0); |
| | | taskCache.setEndCell(slot); |
| | | taskCache.setTaskType(1); |
| | | taskCache.setCreateTime(new Date()); |
| | | taskCacheService.insertTaskCache(taskCache); |
| | | log.info("6、发送确认字"); |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | log.info("7、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | | |
| | | private void outTo(int line, String confirmationWrodAddress) { |
| | | Assert.isTrue(line != 0, "A09、A10都有玻璃,无法出片"); |
| | | log.info("1、出片任务出【{}】号线,备注(09空闲:1;10空闲:2;都空闲:3)", line); |
| | | /** |
| | | * 出片任务 |
| | | * |
| | | * @param out08Glassstate |
| | | * @param out10Glassstate |
| | | * @param confirmationWrodAddress |
| | | */ |
| | | private boolean outTo(int out08Glassstate, int out10Glassstate, String confirmationWrodAddress) { |
| | | //逻辑步骤: |
| | | // 0、A09、A10是否空闲,是否可以执行出片任务 |
| | | // 1、获取钢化版图是否超过阈值 |
| | | // 1.1、超过阈值:获取当前最小版图需要出片的玻璃信息 |
| | | // 1.1.1、获取两条线最后一次出片的任务信息 |
| | | // 1.1.2、按照出片信息去详情表查询格子在笼子里面剩余相同尺寸的玻璃数据 |
| | | // 1.1.3、判断哪条线玻璃数量在理片笼内的数据最少,决定最小版图走该条线(问题:如果这条线非空闲,直接结束) |
| | | // 1.2、未超过阈值: |
| | | // 1.2.1、获取程序那条线空闲 |
| | | // 1.2.2、获取该条线最后一次出片的任务信息 |
| | | // 1.2.3、按照出片信息去详情表查询格子在笼子里面剩余相同尺寸的玻璃数据且以版图id、版序升序排序 取第一块玻璃出片 |
| | | // 2、如果没有历史出片任务 |
| | | // 2.1、出当前版图id最小版序最小的玻璃(问题:两条线都没有历史任务,出片时两条线的玻璃尺寸相同,是否找尺寸不同的) |
| | | Assert.isFalse(out08Glassstate == 0 && out10Glassstate == 0, "A09、A10都有玻璃,无法出片"); |
| | | log.info("0、出片任务出的状态:A09:【{}】;A10:【{}】)", out08Glassstate, out10Glassstate); |
| | | //定义出片玻璃信息 |
| | | int endcell = 0; |
| | | EdgStorageCageDetails glassInfo = null; |
| | | boolean flag = queryMaxMinDiff(threshold); |
| | | log.info("1、获取钢化版图是否超过阈值:{}", flag); |
| | | if (flag) { |
| | | glassInfo = queryMinGlass(0.0, 0.0); |
| | | log.info("1.1、超过阈值:获取当前最小版图需要出片的玻璃信息:{}", glassInfo); |
| | | Integer a09Count = queryCountByTaskLine(Const.A09_OUT_TARGET_POSITION).size(); |
| | | Integer a10Count = queryCountByTaskLine(Const.A10_OUT_TARGET_POSITION).size(); |
| | | log.info("1.2、获取笼子剩余数量A09为{},A10为{}", a09Count, a10Count); |
| | | |
| | | List<TaskCache> oldTaskCacheList; |
| | | if (line == 2) { |
| | | endcell = Const.A10_OUT_TARGET_POSITION; |
| | | oldTaskCacheList = taskCacheService.selectLastOutCacheInfos(Const.A10_OUT_TARGET_POSITION); |
| | | // 假设已知 outXXGlassstate 的值只有 0 和 1 两种情况,且 0 表示某种状态,1 表示另一种状态 |
| | | int targetPositionWhenStateZero = (out08Glassstate == 0) ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION; |
| | | int targetPositionWhenStateOne = (out10Glassstate == 0) ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | endcell = (a10Count <= a09Count) ? targetPositionWhenStateZero : targetPositionWhenStateOne; |
| | | } else { |
| | | endcell = Const.A09_OUT_TARGET_POSITION; |
| | | oldTaskCacheList = taskCacheService.selectLastOutCacheInfos(Const.A09_OUT_TARGET_POSITION); |
| | | //当前任务出完无玻璃 更换玻璃 获取另一条线路 |
| | | endcell = out08Glassstate == 1 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | int othercell = endcell == Const.A10_OUT_TARGET_POSITION ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | List<EdgStorageCageDetails> details = queryCountByTaskLine(endcell); |
| | | if (details.size() > 0) { |
| | | glassInfo = details.get(0); |
| | | } else { |
| | | //去理片笼里面查 |
| | | glassInfo = queryChangeGlassInfo(othercell); |
| | | } |
| | | } |
| | | log.info("2、判断出片线路{},获取最后该条线已出片的任务信息{}(备注:0待执行,1已执行).都空闲优先出A09线", endcell, oldTaskCacheList); |
| | | |
| | | String glassId = ""; |
| | | if (CollectionUtil.isNotEmpty(oldTaskCacheList)) { |
| | | glassId = oldTaskCacheList.get(0).getGlassId(); |
| | | } |
| | | EdgStorageCageDetails glassInfo = edgStorageCageDetailsService.selectOutGlass(glassId, threshold); |
| | | log.info("3、按照历史已出玻璃id{}和阈值{},拿出理片笼内的出片信息{}", glassId, threshold, glassInfo); |
| | | |
| | | if (glassInfo != null) { |
| | | log.info("4、添加出片任务,玻璃id:{},任务类型:{},起始位置:{},结束位置:{}", glassInfo.getGlassId(), |
| | | 2, glassInfo.getSlot(), endcell); |
| | | TaskCache taskCache = new TaskCache(); |
| | | taskCache.setGlassId(glassInfo.getGlassId()); |
| | | taskCache.setTaskStatus(0); |
| | | taskCache.setStartCell(glassInfo.getSlot()); |
| | | taskCache.setEndCell(endcell); |
| | | taskCache.setTaskType(2); |
| | | taskCache.setCreateTime(new Date()); |
| | | taskCacheService.insertTaskCache(taskCache); |
| | | |
| | | LambdaQueryWrapper<EdgStorageCageDetails> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(EdgStorageCageDetails::getGlassId, glassInfo.getGlassId()); |
| | | EdgStorageCageDetails updateDetail = new EdgStorageCageDetails(); |
| | | updateDetail.setState(Const.GLASS_STATE_OUT); |
| | | edgStorageCageDetailsService.update(updateDetail, wrapper); |
| | | log.info("5、更新出片玻璃的状态为{}", Const.GLASS_STATE_OUT); |
| | | |
| | | boolean taskCacheStatus = saveTaskCache(glassInfo.getGlassId(), glassInfo.getSlot(), endcell, Const.GLASS_CACHE_TYPE_OUT); |
| | | log.info("6、添加出片任务是否完成:{}", taskCacheStatus); |
| | | |
| | | boolean glassSizeStatus = saveGlassSize(glassInfo); |
| | | log.info("7、添加出片玻璃尺寸信息到磨边前玻璃表是否完成:{}", glassSizeStatus); |
| | | |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | log.info("8、发送确认字已完成"); |
| | | return Boolean.TRUE; |
| | | } |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | /** |
| | | * 获取详情表内最大最小版图id的差值,判断是否出最小版图玻璃 |
| | | * |
| | | * @return |
| | | */ |
| | | private boolean queryMaxMinDiff(int threshold) { |
| | | //获取笼子内最大版图id和最小版图id插值,判断是否大于阈值,大于阈值直接出最小版图玻璃 |
| | | QueryWrapper<EdgStorageCageDetails> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("max(tempering_layout_id)-min(tempering_layout_id) as diff") |
| | | .eq("state", Const.GLASS_STATE_IN); |
| | | List<Object> list = edgStorageCageDetailsService.listObjs(queryWrapper); |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | Long diff = (Long) list.get(0); |
| | | return diff > threshold; |
| | | } else { |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前最小版图需要出片的玻璃信息 |
| | | * |
| | | * @param width |
| | | * @param height |
| | | */ |
| | | private EdgStorageCageDetails queryMinGlass(Double width, Double height) { |
| | | return edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getState, 100) |
| | | .eq(width != 0, EdgStorageCageDetails::getWidth, width) |
| | | .eq(height != 0, EdgStorageCageDetails::getHeight, height) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | .last("limit 1")); |
| | | } |
| | | |
| | | /** |
| | | * 获取任务表中指定线路笼子内还剩余的玻璃数量 |
| | | */ |
| | | private List<EdgStorageCageDetails> queryCountByTaskLine(int line) { |
| | | //获取任务表中最后一次出片的玻璃id |
| | | LambdaQueryWrapper<TaskCache> queryWrapper = new LambdaQueryWrapper<TaskCache>().eq(TaskCache::getTaskType, Const.GLASS_CACHE_TYPE_OUT) |
| | | .eq(TaskCache::getEndCell, line).orderByDesc(TaskCache::getCreateTime); |
| | | List<TaskCache> taskCacheList = taskCacheService.list(queryWrapper); |
| | | if (CollectionUtil.isEmpty(taskCacheList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | TaskCache taskCache = taskCacheList.get(0); |
| | | MPJQueryWrapper<EdgStorageCageDetails> mpjLambdaWrapper = new MPJQueryWrapper<>(); |
| | | mpjLambdaWrapper.select("t1.*") |
| | | .innerJoin("edg_storage_cage_details t1 on t.width = t1.width and t.height = t1.height") |
| | | .eq("t.glass_id", taskCache.getGlassId()) |
| | | .ne("t1.glass_id", taskCache.getGlassId()) |
| | | .orderByAsc("t1.tempering_layout_id", "t1.tempering_feed_sequence"); |
| | | List<EdgStorageCageDetails> details = edgStorageCageDetailsService.selectJoinList(EdgStorageCageDetails.class, mpjLambdaWrapper); |
| | | if (CollectionUtil.isEmpty(details)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return details; |
| | | } |
| | | |
| | | /** |
| | | * 更换出片玻璃 |
| | | * |
| | | * @param othercell |
| | | * @return |
| | | */ |
| | | private EdgStorageCageDetails queryChangeGlassInfo(int othercell) { |
| | | //获取笼子内数量前二的玻璃数量 |
| | | MPJLambdaWrapper<EdgStorageCageDetails> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .selectCount(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getCount) |
| | | .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | | log.info("获取笼子内数量前二的玻璃数量:{}", list); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | log.info("笼子里没有玻璃"); |
| | | return null; |
| | | } |
| | | //一片玻璃直接出 |
| | | //获取宽高拍第一的玻璃信息 |
| | | EdgStorageCageDetails firstSize = list.get(0); |
| | | Integer firstCount = firstSize.getCount(); |
| | | Double firstWidth = firstSize.getWidth(); |
| | | Double firstHeight = firstSize.getHeight(); |
| | | if (list.size() == 1) { |
| | | return queryMinGlass(firstWidth, firstHeight); |
| | | } |
| | | //获取宽高拍第二的玻璃信息 |
| | | EdgStorageCageDetails secondSize = list.get(1); |
| | | //获取任务表中最后一次出片的玻璃id |
| | | LambdaQueryWrapper<TaskCache> queryWrapper = new LambdaQueryWrapper<TaskCache>().eq(TaskCache::getTaskType, Const.GLASS_CACHE_TYPE_OUT) |
| | | .eq(TaskCache::getEndCell, othercell).orderByDesc(TaskCache::getCreateTime); |
| | | List<TaskCache> taskCacheList = taskCacheService.list(queryWrapper); |
| | | log.info("获取任务表中{}线最后一次出片的玻璃任务信息:{}", othercell, taskCacheList); |
| | | if (CollectionUtil.isEmpty(taskCacheList)) { |
| | | log.info("{}线没有出片任务信息,直接出片", othercell); |
| | | return queryMinGlass(firstSize.getWidth(), firstSize.getHeight()); |
| | | } |
| | | |
| | | Integer secondCount = secondSize.getCount(); |
| | | Double secondWidth = secondSize.getWidth(); |
| | | Double secondHeight = secondSize.getHeight(); |
| | | //获取数量前2的玻璃数量比例 |
| | | Integer mix = firstCount / secondCount; |
| | | log.info("获取玻璃数量前2的玻璃占比为:{}", mix); |
| | | |
| | | if (mix >= 2) { |
| | | log.info("获取玻璃数量前2的玻璃占比为{},大于2,直接出玻璃数据的最多的,宽:{},高:{}", mix, firstWidth, firstHeight); |
| | | return queryMinGlass(firstWidth, firstHeight); |
| | | } else { |
| | | log.info("获取玻璃数量前2的玻璃占比为{},小于2", mix); |
| | | TaskCache taskCache = taskCacheList.get(0); |
| | | EdgStorageCageDetails outGlassInfo = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId())); |
| | | log.info("{}线有出片任务信息,任务信息为{},玻璃信息为{}", othercell, taskCache, outGlassInfo); |
| | | if (outGlassInfo.getWidth().equals(firstWidth) && outGlassInfo.getHeight().equals(firstHeight)) { |
| | | log.info("数量最多的宽{}高{}和{}线任务的宽{}高{}相同,出数量排第二的玻璃,宽{}高{}", |
| | | firstWidth, firstHeight, othercell, outGlassInfo.getWidth(), outGlassInfo.getHeight(), secondWidth, secondHeight); |
| | | return queryMinGlass(secondWidth, secondHeight); |
| | | } else { |
| | | log.info("数量第二多的宽{}高{}和{}线任务的宽{}高{}相同,出数量排第二的玻璃,宽{}高{}", |
| | | secondWidth, secondHeight, othercell, outGlassInfo.getWidth(), outGlassInfo.getHeight(), firstWidth, firstHeight); |
| | | return queryMinGlass(firstWidth, firstHeight); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加理片笼任务 |
| | | * |
| | | * @param glassId |
| | | * @param startcell |
| | | * @param endcell |
| | | * @param taskType |
| | | * @return |
| | | */ |
| | | private boolean saveTaskCache(String glassId, int startcell, int endcell, int taskType) { |
| | | TaskCache taskCache = new TaskCache(); |
| | | taskCache.setGlassId(glassId); |
| | | taskCache.setTaskStatus(0); |
| | | taskCache.setStartCell(startcell); |
| | | taskCache.setEndCell(endcell); |
| | | taskCache.setTaskType(taskType); |
| | | taskCache.setCreateTime(new Date()); |
| | | return taskCacheService.save(taskCache); |
| | | } |
| | | |
| | | /** |
| | | * 添加理片笼任务 |
| | | * |
| | | * @param glassInfo |
| | | * @return |
| | | */ |
| | | private boolean saveGlassSize(EdgStorageCageDetails glassInfo) { |
| | | EdgGlassTaskInfo edgGlassTaskInfo = new EdgGlassTaskInfo(); |
| | | BeanUtils.copyProperties(glassInfo, edgGlassTaskInfo); |
| | | edgGlassTaskInfo.setHeight((int) (glassInfo.getEdgHeight() * ratio)); |
| | | edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio)); |
| | | edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio)); |
| | | edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE); |
| | | return edgGlassTaskInfoService.save(edgGlassTaskInfo); |
| | | } |
| | | |
| | | |
| | |
| | | public interface TaskCacheService extends IService<TaskCache> { |
| | | |
| | | /** |
| | | * 添加理片笼任务 |
| | | * @param taskCache |
| | | * @return |
| | | */ |
| | | boolean insertTaskCache(TaskCache taskCache); |
| | | |
| | | /** |
| | | * 查询磨边任务 |
| | | * @param line |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | |
| | | |
| | | /** |
| | | * 添加理片笼任务 |
| | | * @param taskCache |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean insertTaskCache(TaskCache taskCache){ |
| | | baseMapper.insert(taskCache); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查询磨边任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectEdgInfo(String line) { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell,line)); |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell, line)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("end_cell",line)); |
| | | } |
| | | |
| | | /** |
| | | * 查询待理片工作的任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectCacheInfo(){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus,0)); |
| | | public List<TaskCache> selectCacheInfo() { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus, 0)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("task_status",0)); |
| | | } |
| | | |
| | | /** |
| | | * 查询全部任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 查询待进片任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectInputTaskCache(){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus,0).eq(TaskCache::getTaskType,1)); |
| | | public List<TaskCache> selectInputTaskCache() { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus, 0).eq(TaskCache::getTaskType, 1)); |
| | | |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("task_status",0).eq("task_type",1)); |
| | | } |
| | | |
| | | /** |
| | | * 查询待出片任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectOutTaskCache(){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus,0).eq(TaskCache::getTaskType,2)); |
| | | public List<TaskCache> selectOutTaskCache() { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus, 0).eq(TaskCache::getTaskType, 2)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("task_status",0).eq("task_type",2)); |
| | | } |
| | | |
| | | /** |
| | | * 查询 A09 或 A10 最新的一片 出片任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | @Override |
| | | 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::getCreateTime)); |
| | | public List<TaskCache> selectLastOutCacheInfos(int line) { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell, line).eq(TaskCache::getTaskStatus, 1).orderByDesc(TaskCache::getCreateTime)); |
| | | // 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::getCreateTime)); |
| | | public TaskCache selectLastOutCacheInfo(String line) { |
| | | return baseMapper.selectOne(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell, line).eq(TaskCache::getTaskStatus, 1).orderByDesc(TaskCache::getCreateTime)); |
| | | } |
| | | |
| | | |
| | |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "Current_slot", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MES_confirmation_word", |
| | | "addressIndex":"38", |
| | | "addressLenght":"2", |
| | |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "A09_glass_status", |
| | | "codeId": "A08_glass_status", |
| | | "addressIndex":"68", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | |
| | | server: |
| | | port: 8085 |
| | | port: 8081 |
| | | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | application: |
| | | name: unLoadGlass |
| | | name: cacheGlass |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | mes: |
| | | threshold: 3 |
| | | ratio: 10 |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.S7object; |
| | | import com.mes.job.PlcStorageCageTask; |
| | | 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) |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | |
| | | private final PlcStorageCageTask plcStorageCageTask; |
| | | |
| | | public AppRunnerConfig(PlcStorageCageTask plcStorageCageTask) { |
| | | this.plcStorageCageTask = plcStorageCageTask; |
| | | } |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | log.info("启动完成"); |
| | | S7object.getinstance().start(); |
| | | |
| | | } |
| | | } |
| | |
| | | */ |
| | | public interface BigStorageCageService extends IService<BigStorageCage> { |
| | | |
| | | void updateRemainWidth(int Slot); |
| | | void updateRemainWidth(int slot); |
| | | |
| | | BigStorageCageDetails feedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails); |
| | | |
| | |
| | | bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot()); |
| | | } else { |
| | | log.info("3、查询理片笼内片序+1等于当前玻璃片序的玻璃的结果为空时获取当前玻璃版图id是否存在理片笼内"); |
| | | LambdaQueryWrapper<BigStorageCageDetails> BigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | BigStorageCageDetailslambdaQueryWrapper |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | bigStorageCageDetailslambdaQueryWrapper |
| | | .select(BigStorageCageDetails::getTemperingLayoutId); |
| | | layoutSlotInfo = bigStorageCageDetailsMapper.selectOne(BigStorageCageDetailslambdaQueryWrapper); |
| | | layoutSlotInfo = bigStorageCageDetailsMapper.selectOne(bigStorageCageDetailslambdaQueryWrapper); |
| | | |
| | | if(layoutSlotInfo != null){ |
| | | log.info("4、获取笼子内适合的格子"); |
| | |
| | | .apply("LEFT JOIN (SELECT device_id, tempering_layout_id FROM big_storage_cage_details) b ON a.device_id = b.device_id AND a.slot = b.slot") |
| | | .orderByAsc("layoutCount") |
| | | .orderByAsc("a.device_id"); |
| | | List<Map<String, Object>> BigStorageCageDetailsCount= bigStorageCageDetailsMapper.selectMaps(queryWrapper); |
| | | List<Map<String, Object>> bigStorageCageDetailsCount= bigStorageCageDetailsMapper.selectMaps(queryWrapper); |
| | | |
| | | log.info("5、查询笼子内是否有合适的格子"); |
| | | for (Map<String, Object> map : BigStorageCageDetailsCount) { |
| | | for (Map<String, Object> map : bigStorageCageDetailsCount) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | int deviceId = Integer.parseInt(entry.getKey()); |
| | | BigStorageCage bigStorageCage=bigStorageCageSlot(deviceId); |
| | |
| | | } |
| | | } |
| | | } |
| | | log.info("6、当找到合适的格子时添加玻璃到笼子表"); |
| | | |
| | | if (bigStorageCageDetails.getSlot() != null) { |
| | | log.info("6、当找到合适的格子时添加玻璃到笼子表"); |
| | | bigStorageCageDetails.setState(0); |
| | | bigStorageCageDetailsMapper.insert(bigStorageCageDetails); |
| | | updateRemainWidth(bigStorageCageDetails.getSlot()) ; |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | |
| | | String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheVerticalGlass.json").getPath(); |
| | | //log.info(PLCAutoMes.class.getResource("").getPath()); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.websocket.*; |
| | | import javax.websocket.server.PathParam; |
| | | import javax.websocket.server.ServerEndpoint; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | @ServerEndpoint(value = "/api/talk/{username}") |
| | | @Component("webSocketServer") |
| | | public class WebSocketServer { |
| | | |
| | | |
| | | public static ConfigurableApplicationContext applicationContext; |
| | | |
| | | // 解决无法注入mapper问题 //使用方法 |
| | | // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) { |
| | | WebSocketServer.applicationContext = configurableApplicationContext; |
| | | } |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class); |
| | | private List<String> messages; |
| | | /** |
| | | * 记录当前在线连接数 |
| | | */ |
| | | public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>(); |
| | | |
| | | String username; |
| | | Session session; |
| | | |
| | | public WebSocketServer() { |
| | | this.messages = new ArrayList<>(); |
| | | } |
| | | |
| | | /** |
| | | * 连接建立成功调用的方法 |
| | | */ |
| | | @OnOpen |
| | | public void onOpen(Session session, @PathParam("username") String username) { |
| | | this.username = username; |
| | | this.session = session; |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | if (webSocketServers == null) { |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | | arrayListwebserver.add(this); |
| | | sessionMap.put(username, arrayListwebserver); |
| | | } else { |
| | | webSocketServers.add(this); |
| | | } |
| | | |
| | | log.info("有新用户加入,username={}, 当前在线人数为:{}", username, sessionMap.get(username).size()); |
| | | |
| | | // JSONObject result = new JSONObject(); |
| | | // JSONArray array = new JSONArray(); |
| | | // result.set("users", array); |
| | | // for (Object key : sessionMap.keySet()) { |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.set("username", key); |
| | | // array.add(jsonObject); |
| | | // } |
| | | |
| | | // sendAllMessage(JSONUtil.toJsonStr(result)); // 后台发送消息给所有的客户端 |
| | | } |
| | | |
| | | /** |
| | | * 连接关闭调用的方法 |
| | | */ |
| | | @OnClose |
| | | public void onClose(Session session, @PathParam("username") String username) { |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | | if (webSocketServers.size() > 1) { |
| | | for (WebSocketServer webSocketServer : webSocketServers) { |
| | | if (webSocketServer != this) { |
| | | arrayListwebserver.add(webSocketServer); |
| | | } |
| | | } |
| | | sessionMap.put(username, arrayListwebserver); |
| | | log.info("移除username={}一名用户session, {}的当前在线人数为:{}", username, username, sessionMap.get(username).size()); |
| | | } else { |
| | | sessionMap.remove(username); |
| | | log.info("移除username={}一名用户session, {}连接关闭, 当前连接数为:{}", username, username, sessionMap.size()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 收到客户端消息后调用的方法 |
| | | * 后台收到客户端发送过来的消息 |
| | | * onMessage 是一个消息的中转站 |
| | | * 接受 浏览器端 socket.send 发送过来的 json数据 |
| | | * |
| | | * @param message 客户端发送过来的消息 |
| | | */ |
| | | @OnMessage |
| | | public void onMessage(String message, Session session, @PathParam("username") String username) { |
| | | log.info("服务端收到用户username={}的消息:{}", username, message); |
| | | JSONObject obj = JSONUtil.parseObj(message); |
| | | String text = obj.getStr("data"); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.set("message", text); |
| | | this.messages.add(text); |
| | | this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject) |
| | | |
| | | } |
| | | |
| | | @OnError |
| | | public void onError(Session session, Throwable error) { |
| | | log.error("发生错误"); |
| | | error.printStackTrace(); |
| | | } |
| | | |
| | | /** |
| | | * 服务端发送消息给客户端 |
| | | */ |
| | | public void sendMessage(String message) { |
| | | try { |
| | | // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | this.session.getBasicRemote().sendText(message); |
| | | } catch (Exception e) { |
| | | log.error("服务端发送消息给客户端失败", e); |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 服务端发送消息给所有客户端 |
| | | // */ |
| | | // public void sendAllMessage(String message) { |
| | | // try { |
| | | // for (WebSocketServer webSocketServer : sessionMap.values()) { |
| | | // // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | // webSocketServer.sendMessage(message); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("服务端发送消息给客户端失败", e); |
| | | // } |
| | | // } |
| | | |
| | | public List<String> getMessages() { |
| | | return messages; |
| | | |
| | | } |
| | | |
| | | public void clearMessages() { |
| | | messages.clear(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.WebSocketServer; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgstoragetask.service.TaskCacheService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class PlcStorageCageTask { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Autowired |
| | | @Resource |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Autowired |
| | | @Resource |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | @Resource |
| | | private BigStorageCageFeedTaskService bigStorageCageFeedTaskService; |
| | | @Autowired |
| | | @Resource |
| | | private BigStorageCageOutTaskService bigStorageCageOutTaskService; |
| | | @Autowired |
| | | @Resource |
| | | private TaskCacheService taskCacheService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysMenuService sysMenuService; |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | |
| | | public void plcStorageCageTask() throws InterruptedException { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |
| | | Thread.sleep(300); |
| | | // 爆笼报警 |
| | | boolean bigStorageCageFullAlarm = false; |
| | | |
| | | String plcD01FeedReq = "0"; |
| | | String plcD04FeedReq = "0"; |
| | | String plcFeedGlassid = "111"; |
| | | String plcFeedGlassid = ""; |
| | | String plcFeedReqLine = "0"; |
| | | if ("1".equals(plcD01FeedReq)) { |
| | | if ("1".equals(plcParameterObject.getPlcParameter("D01Request").getValue())) { |
| | | plcFeedReqLine = "1"; |
| | | } else { |
| | | //plc任务发送字0 |
| | | plcFeedGlassid=plcParameterObject.getPlcParameter("D01ID1").getValue(); |
| | | } |
| | | if ("1".equals(plcD04FeedReq)) { |
| | | if ("1".equals(plcParameterObject.getPlcParameter("D04Request").getValue())) { |
| | | plcFeedReqLine = "2"; |
| | | } else { |
| | | //plc任务发送字0 |
| | | plcFeedGlassid=plcParameterObject.getPlcParameter("D04ID1").getValue(); |
| | | } |
| | | |
| | | if (!("0".equals(plcFeedReqLine))) { |
| | |
| | | log.info("3、查询任务表判断当前任务类型为上车等到还是上车启动" + taskType); |
| | | bigStorageCageFeedTaskService.addFeedTask(slotInfo, Integer.parseInt(plcFeedReqLine), taskType); |
| | | log.info("4、添加任务到任务表"); |
| | | //plc任务发送字1 |
| | | bigStorageCageFullAlarm = false; |
| | | } else { |
| | | //理片笼爆笼报警 |
| | | bigStorageCageFullAlarm = true; |
| | | } |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | //出片请求 |
| | | String plcOutReq = "0"; |
| | | boolean result = false; |
| | | if ("1".equals(plcOutReq)) { |
| | | result = bigStorageCageService.outGlass(); |
| | | log.info("8、出片请求时调用出片接口" + result); |
| | | if (result) { |
| | | //plc任务发送字1 |
| | | } |
| | | } else { |
| | | bigStorageCageOutTaskService.updateOutTask(); |
| | | //plc任务发送字0 |
| | | //查询出片表是否有任务未完成的任务 |
| | | List<BigStorageCageOutTask> bigStorageCageOutTask=bigStorageCageOutTaskService.querybigStorageCageOutTask(0); |
| | | if(bigStorageCageOutTask.size()==0){ |
| | | bigStorageCageService.outGlass(); |
| | | log.info("8、没有未完成任务时调用出片接口"); |
| | | } |
| | | |
| | | //显示剩余空格子 |
| | | bigStorageCageOutTaskService.updateOutTask(); |
| | | log.info("9、根据任务表状态修改钢化小片表任务状态"); |
| | | |
| | | //报警信息 |
| | | jsonObject.append("bigStorageCageFullAlarm", bigStorageCageFullAlarm); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB.0", |
| | | "plcAddressLenght":"72", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "D01Request", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "D01ID1", |
| | | "addressIndex":"2", |
| | | "addressLenght":"6", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D04Request", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D04ID1", |
| | | "addressIndex":"10", |
| | | "addressLenght":"6", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D02Go", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D05Go", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "DeviceStatus", |
| | | "addressIndex":"70", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.S7object; |
| | | import com.mes.job.PlcLoadGlassTask; |
| | | 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) |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | |
| | | private final PlcLoadGlassTask plcLoadGlassTask; |
| | | |
| | | public AppRunnerConfig(PlcLoadGlassTask plcLoadGlassTask) { |
| | | this.plcLoadGlassTask = plcLoadGlassTask; |
| | | } |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | log.info("启动完成"); |
| | | S7object.getinstance().start(); |
| | | |
| | | } |
| | | } |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @EnableScheduling |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class LoadGlassModuleApplication { |
| | | public static void main(String[] args) { |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object { |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | |
| | | String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcLoadGlass.json").getPath(); |
| | | //log.info(PLCAutoMes.class.getResource("").getPath()); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.websocket.*; |
| | | import javax.websocket.server.PathParam; |
| | | import javax.websocket.server.ServerEndpoint; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | @ServerEndpoint(value = "/api/talk/{username}") |
| | | @Component("webSocketServer") |
| | | public class WebSocketServer { |
| | | |
| | | |
| | | public static ConfigurableApplicationContext applicationContext; |
| | | |
| | | // 解决无法注入mapper问题 //使用方法 |
| | | // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) { |
| | | WebSocketServer.applicationContext = configurableApplicationContext; |
| | | } |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class); |
| | | private List<String> messages; |
| | | /** |
| | | * 记录当前在线连接数 |
| | | */ |
| | | public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>(); |
| | | |
| | | String username; |
| | | Session session; |
| | | |
| | | public WebSocketServer() { |
| | | this.messages = new ArrayList<>(); |
| | | } |
| | | |
| | | /** |
| | | * 连接建立成功调用的方法 |
| | | */ |
| | | @OnOpen |
| | | public void onOpen(Session session, @PathParam("username") String username) { |
| | | this.username = username; |
| | | this.session = session; |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | if (webSocketServers == null) { |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | | arrayListwebserver.add(this); |
| | | sessionMap.put(username, arrayListwebserver); |
| | | } else { |
| | | webSocketServers.add(this); |
| | | } |
| | | |
| | | log.info("有新用户加入,username={}, 当前在线人数为:{}", username, sessionMap.get(username).size()); |
| | | |
| | | // JSONObject result = new JSONObject(); |
| | | // JSONArray array = new JSONArray(); |
| | | // result.set("users", array); |
| | | // for (Object key : sessionMap.keySet()) { |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.set("username", key); |
| | | // array.add(jsonObject); |
| | | // } |
| | | |
| | | // sendAllMessage(JSONUtil.toJsonStr(result)); // 后台发送消息给所有的客户端 |
| | | } |
| | | |
| | | /** |
| | | * 连接关闭调用的方法 |
| | | */ |
| | | @OnClose |
| | | public void onClose(Session session, @PathParam("username") String username) { |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | | if (webSocketServers.size() > 1) { |
| | | for (WebSocketServer webSocketServer : webSocketServers) { |
| | | if (webSocketServer != this) { |
| | | arrayListwebserver.add(webSocketServer); |
| | | } |
| | | } |
| | | sessionMap.put(username, arrayListwebserver); |
| | | log.info("移除username={}一名用户session, {}的当前在线人数为:{}", username, username, sessionMap.get(username).size()); |
| | | } else { |
| | | sessionMap.remove(username); |
| | | log.info("移除username={}一名用户session, {}连接关闭, 当前连接数为:{}", username, username, sessionMap.size()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 收到客户端消息后调用的方法 |
| | | * 后台收到客户端发送过来的消息 |
| | | * onMessage 是一个消息的中转站 |
| | | * 接受 浏览器端 socket.send 发送过来的 json数据 |
| | | * |
| | | * @param message 客户端发送过来的消息 |
| | | */ |
| | | @OnMessage |
| | | public void onMessage(String message, Session session, @PathParam("username") String username) { |
| | | log.info("服务端收到用户username={}的消息:{}", username, message); |
| | | JSONObject obj = JSONUtil.parseObj(message); |
| | | String text = obj.getStr("data"); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.set("message", text); |
| | | this.messages.add(text); |
| | | this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject) |
| | | |
| | | } |
| | | |
| | | @OnError |
| | | public void onError(Session session, Throwable error) { |
| | | log.error("发生错误"); |
| | | error.printStackTrace(); |
| | | } |
| | | |
| | | /** |
| | | * 服务端发送消息给客户端 |
| | | */ |
| | | public void sendMessage(String message) { |
| | | try { |
| | | // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | this.session.getBasicRemote().sendText(message); |
| | | } catch (Exception e) { |
| | | log.error("服务端发送消息给客户端失败", e); |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 服务端发送消息给所有客户端 |
| | | // */ |
| | | // public void sendAllMessage(String message) { |
| | | // try { |
| | | // for (WebSocketServer webSocketServer : sessionMap.values()) { |
| | | // // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | // webSocketServer.sendMessage(message); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("服务端发送消息给客户端失败", e); |
| | | // } |
| | | // } |
| | | |
| | | public List<String> getMessages() { |
| | | return messages; |
| | | |
| | | } |
| | | |
| | | public void clearMessages() { |
| | | messages.clear(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.common.S7object; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import com.mes.workstation.service.UpWorkstationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PlcLoadGlassTask { |
| | | |
| | | @Autowired |
| | | private UpWorkstationService upWorkstationService; |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private UpPattenUsageService upPattenUsageService; |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |
| | | Thread.sleep(300); |
| | | upWorkstationService.selectPriority(); |
| | | //获取是否有上片请求 |
| | | String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue(); |
| | | //判断开始上片的工程号 |
| | | Engineering engineering = engineeringService.selectInitiate(1); |
| | | if ("1".equals(loadRequest) && engineering != null) { |
| | | log.info("开始上片任务"); |
| | | UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering); |
| | | log.info("当有请求时查询当前上片顺序的玻璃信息{}", upPattenUsage); |
| | | UpWorkstation upwork = upWorkstationService.selectWorkstation(upPattenUsage); |
| | | log.info("符合的尺寸的工位玻璃:{}", upwork); |
| | | if (upwork != null) { |
| | | int workId = upwork.getWorkstationId();//工位id |
| | | double width = upwork.getPatternWidth();//宽度 |
| | | double height = upwork.getPatternHeight();//高度 |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("WorkId").getAddress(), workId); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (long) width); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (long) height); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 1); |
| | | //更改上片表状态 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId); |
| | | |
| | | } |
| | | }else { |
| | | //请求字为零时,任务字清零 |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0); |
| | | } |
| | | //执行后休眠300毫秒 |
| | | //Thread.sleep(300); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport(){ |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | | if (loadStatus != null) { |
| | | log.info(loadStatus); |
| | | if ("1".equals(loadStatus)) { |
| | | log.info("收到汇报任务完成"); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | } else if ("2".equals(loadStatus)) { |
| | | log.info("收到汇报未完成任务"); |
| | | //减少工位数量,恢复任务状态 |
| | | overTask(loadStatus,0); |
| | | } else if ("3".equals(loadStatus)) { |
| | | log.info("收到汇报玻璃破损"); |
| | | overTask(loadStatus,0); |
| | | } else if("0".equals(loadStatus)){ |
| | | log.info("收到汇报清0状态"); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus,100); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask(); |
| | | if (upPattenUsage != null) { |
| | | log.info("收到汇报清{}状态", loadStatus); |
| | | //减少工位数量 |
| | | upWorkstationService.reduceWorkstationNumber(upPattenUsage.getState()); |
| | | //完成上片表状态 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, state); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 原片高 |
| | | */ |
| | | private Double patternHeigth; |
| | | private Double patternHeight; |
| | | |
| | | /** |
| | | * 原片厚度 |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.workstation.entity.UpWorkSequence; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import io.lettuce.core.dynamic.annotation.Param; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | package com.mes.workstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.workstation.entity.UpWorkSequence; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | |
| | | /** |
| | |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpWorkstationService extends IService<UpWorkstation> { |
| | | //PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | |
| | | |
| | | |
| | | //判断优先吸片位置后发送出片任务 |
| | | UpWorkSequence selectPriority(); |
| | | |
| | | //查询正在进行的工程 |
| | | |
| | | |
| | | //判断优先吸片玻璃 |
| | | /** |
| | | * 判断优先吸片位置 |
| | | * @return UpPattenUsage |
| | | */ |
| | | UpPattenUsage selectPriority(Engineering engineering); |
| | | /** |
| | | * 查询正在进行的单片信息 |
| | | * @return UpWorkstation |
| | | */ |
| | | UpWorkstation selectWorkstation(UpPattenUsage upPattenUsage); |
| | | /** |
| | | * 减少工位数量 |
| | | */ |
| | | void reduceWorkstationNumber(Integer upworkId); |
| | | /** |
| | | * 增加人工输入的工位玻璃信息 |
| | | * |
| | | * @param upwork |
| | | */ |
| | | //修改工位表增加玻璃信息或者删除玻璃信息 |
| | | void updateGlassMessage(UpWorkstation upwork); |
| | | |
| | | |
| | |
| | | package com.mes.workstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import com.mes.workstation.entity.UpWorkSequence; |
| | |
| | | public class UpWorkstationServiceImpl extends ServiceImpl<UpWorkstationMapper, UpWorkstation> implements UpWorkstationService { |
| | | @Resource |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | public static final String DB_100_10 = "DB_100_10"; |
| | | |
| | | //判断是否可以吸片进行任务 |
| | | public boolean isCanLoadGlass() { |
| | | String loadstart = "吸片信号";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | return "1".equals(loadstart); |
| | | |
| | | } |
| | | //显示正在进行任务的工程信息 |
| | | @Resource |
| | | UpWorkstationMapper upWorkstationMapper; |
| | | |
| | | |
| | | //判断优先吸片位置后发送出片任务 |
| | | |
| | | public UpWorkSequence selectPriority() { |
| | | UpWorkSequence upwork= this.baseMapper.selectPriority(1); |
| | | String start = "1";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | UpPattenUsage uplist=new UpPattenUsage(); |
| | | if(start.equals("1")){ |
| | | //发送出片任务 |
| | | UpdateWrapper<UpPattenUsage> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("state",1).last("LIMIT 1"); |
| | | uplist= upPattenUsageMapper.selectOne(updateWrapper); |
| | | log.info("查询出本次出片的玻璃信息[]",uplist); |
| | | } |
| | | return upwork; |
| | | public UpPattenUsage selectPriority(Engineering engineering) { |
| | | QueryWrapper<UpPattenUsage> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("state", 0) |
| | | .eq("engineering_id",engineering.getEngineerId()) |
| | | .orderByAsc("layout_sequence") |
| | | .last("limit 1"); |
| | | return upPattenUsageMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | //判断工位是否有符合条件的玻璃 |
| | | @Override |
| | | public UpWorkstation selectWorkstation(UpPattenUsage upPattenUsage) { |
| | | QueryWrapper<UpWorkstation> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("pattern_width", upPattenUsage.getWidth()) |
| | | .eq("pattern_height", upPattenUsage.getHeight()) |
| | | .eq("pattern_thickness", upPattenUsage.getThickness()) |
| | | .eq("films_id", upPattenUsage.getFilmsId()) |
| | | .gt("number", 0) |
| | | .orderByAsc("number") |
| | | .last("limit 1"); |
| | | return this.baseMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void reduceWorkstationNumber(Integer upworkId) { |
| | | UpdateWrapper<UpWorkstation> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("id", upworkId) |
| | | .setSql("number = number - 1"); |
| | | boolean updateResult = upWorkstationMapper.update(null, wrapper) > 0; |
| | | log.info("减少工位数量{}",updateResult); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 增加人工输入的工位玻璃信息/删除人工搬走的玻璃信息 |
| | | * @param upwork |
| | | */ |
| | | @Override |
| | | public void updateGlassMessage(UpWorkstation upwork) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"98", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "loadRequest", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "PlcStatus", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesToPlc", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "WorkId", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "GlassWidth", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "GlassHeight", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "MesToPlcStatus", |
| | | "addressIndex":"40", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesToPlcStatusId", |
| | | "addressIndex":"42", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesTaskStatus", |
| | | "addressIndex":"56", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | ] |
| | | } |
| | |
| | | name: loadGlass |
| | | 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 打印sql语句 |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.impl.UpPattenUsageServiceImpl; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import com.mes.workstation.service.UpWorkstationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/27 16:37 |
| | | * @Description: |
| | | |
| | | */ |
| | | @Slf4j |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = LoadGlassModuleApplication.class) |
| | | public class LoadGlassModuleApplicationTest { |
| | | |
| | | @Resource |
| | | private OptimizeProjectMapper optimizeProjectMapper; |
| | | // @Resource |
| | | // private OptimizeProjectMapper optimizeProjectMapper; |
| | | @Autowired |
| | | private UpPattenUsageServiceImpl upPattenUsageService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private UpWorkstationService workstationService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @Test |
| | | public void test() { |
| | | // List<OptimizeProject> list = optimizeProjectMapper.saveProject("P24032204"); |
| | |
| | | |
| | | @Test |
| | | public void testFindPa() { |
| | | List<UpPattenUsage> glass = upPattenUsageService.selectSaveUpPattenUsage("P24032204"); |
| | | log.info("完整路径:{}", Arrays.asList(glass)); |
| | | Engineering engineering= engineeringService.selectInitiate(1); |
| | | log.info("开始上片的工程:{}", Arrays.asList(engineering)); |
| | | UpPattenUsage upPattenUsage = workstationService.selectPriority(engineering); |
| | | log.info("上片顺序:{}", Arrays.asList(upPattenUsage)); |
| | | UpWorkstation glass2=workstationService.selectWorkstation(upPattenUsage); |
| | | log.info("符合的工位玻璃{}",glass2); |
| | | workstationService.reduceWorkstationNumber(glass2.getWorkstationId()); |
| | | //减少数量 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage,1); |
| | | //更新状态 |
| | | } |
| | | |
| | | @Test |
| | | public void textglassinfo(){ |
| | | List<GlassInfo> glass= glassInfoService.selectGlassInfo("P24032204"); |
| | | log.info("glassinfo:{}", Arrays.asList(glass)); |
| | | glassInfoService.saveGlassInfo(glass); |
| | | } |
| | | @Test |
| | | public void textengineering(){ |
| | | List<Engineering> glass= engineeringService.selectEngineering("P24032204"); |
| | | engineeringService.saveEngineering(glass); |
| | | log.info("glassinfo:{}", Arrays.asList(glass)); |
| | | } |
| | | @Test |
| | | public void textengineering2(){ |
| | | //更新工程表状态为已领取 |
| | | optimizeProjectService.changeTask("P24050801",200); |
| | | } |
| | | @Test |
| | | public void textengineering3(){ |
| | | //判断是否已保存过工程号到上片表 |
| | | UpPattenUsage upPattenUsage=upPattenUsageService.selectOverTask(); |
| | | log.info("上片表任务中的数据{}",upPattenUsage); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.S7object; |
| | | 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; |
| | | |
| | | /** |
| | | * @author SNG-012 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @Order(1) |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | log.info("启动完成"); |
| | | S7object.getinstance().start(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | |
| | | String PlcCacheGlass=S7object.class.getResource("/JsonFile/PlcdownGlass.json").getPath(); |
| | | //log.info(PLCAutoMes.class.getResource("").getPath()); |
| | | PlcMesObject = InitUtil.initword(PlcCacheGlass); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | /** |
| | | * 下片玻璃信息表id |
| | | */ |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Double thickness; |
| | | |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String Filmsid; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private String glassId; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * 玻璃id |
| | | */ |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date CreateTime; |
| | | } |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | void updateTaskStateToZero(long id); |
| | | void updateTaskState(String id); |
| | | |
| | | /** |
| | | * 删除任务 |
| | |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.downworkstation.service.DownWorkstationTaskService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | @Override |
| | | public void insertDownGlassInfo(DownGlassInfo downGlassInfo) { |
| | | |
| | | |
| | | |
| | | baseMapper.insert(downGlassInfo); |
| | | } |
| | | |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public List<DownGlassTask> getUnloadingTaskState() { |
| | | QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_stauts", 1); |
| | | queryWrapper.eq("task_stauts", 0); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTaskStateToZero(long id) { |
| | | public void updateTaskState(String id) { |
| | | UpdateWrapper<DownGlassTask> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("task_stauts", 0).eq("id", id); |
| | | updateWrapper.set("task_stauts", 2).eq("id", id); |
| | | baseMapper.update(new DownGlassTask(), updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteTask(String id) { |
| | | LambdaQueryWrapper<DownGlassTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DownGlassTask::getFlowCardId, id); |
| | | queryWrapper.eq(DownGlassTask::getGlassId, id); |
| | | |
| | | baseMapper.delete(queryWrapper); |
| | | } |
| | |
| | | // 如果主键值不存在,则进行插入操作 |
| | | DownGlassTask newDownGlassTask = new DownGlassTask(); |
| | | BeanUtils.copyProperties(downGlassTask, newDownGlassTask); |
| | | newDownGlassTask.setTaskStauts(0); // 默认任务状态为0 |
| | | |
| | | newDownGlassTask.setTaskStauts(1); // 默认任务状态为1 |
| | | newDownGlassTask.setCreateTime(new Date()); |
| | | int rows = baseMapper.insert(newDownGlassTask); |
| | | return rows > 0 ? rows : null; |
| | | } |
| | |
| | | package com.mes.downstorage.controller; |
| | | |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | |
| | | @ApiOperation("查询缓存理片笼内详情") |
| | | @GetMapping("/selectStorageCage") |
| | | @ResponseBody |
| | | public Result selectEdgStorageCage () { |
| | | List<Map> list=downStorageCageDetailsService.getCacheInfo(); |
| | | public Result selectDownStorageCage () { |
| | | List<Map<String, Object>> list=downStorageCageService.selectDownStorageCages(); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | |
| | | |
| | | // |
| | | // @ApiOperation("添加缓存理片笼信息 功能:笼内绑定玻璃 参数(DownStorageCageDetails downStorageCageDetails)") |
| | | // @PostMapping("/insertEdgStorageCage") |
| | | // @ResponseBody |
| | | // public Result insertEdgStorageCage(@RequestBody DownStorageCageDetails downStorageCageDetails) { |
| | | // boolean isSucess=downStorageCageService.updatedownStorageCageDetails(downStorageCageDetails); |
| | | // return Result.build(200,"添加成功",1); |
| | | // } |
| | | |
| | | @ApiOperation("添加缓存理片笼信息 功能:笼内绑定玻璃 参数(DownStorageCageDetails downStorageCageDetails)") |
| | | @PostMapping("/insertEdgStorageCage") |
| | | @ResponseBody |
| | | public Result insertEdgStorageCage(@RequestBody DownStorageCageDetails downStorageCageDetails) { |
| | | boolean isSucess=downStorageCageDetailsService.updatedownStorageCageDetails(downStorageCageDetails); |
| | | return Result.build(200,"添加成功",1); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("修改缓存理片笼信息 功能:对笼内栅格进行【启用/禁用】/ 【更换】笼内栅格玻璃信息") |
| | | @PostMapping("/updateEdgStorageCage") |
| | | @PostMapping("/updateDownStorageCage") |
| | | @ResponseBody |
| | | public Result updateEdgStorageCage(@RequestBody DownStorageCageDetails downStorageCageDetails) { |
| | | boolean isSucess=downStorageCageDetailsService.updatedownStorageCageDetails(downStorageCageDetails); |
| | | public Result updateDownStorageCage(@RequestBody DownStorageCage downStorageCage) { |
| | | boolean isSucess=downStorageCageService.updateDownStorageCage(downStorageCage); |
| | | return Result.build(200,"更换成功",1); |
| | | } |
| | | @ApiOperation("删除缓存理片笼信息 功能:对笼内栅格玻璃进行【清除】") |
| | | @PostMapping("/deleteEdgStorageCage") |
| | | @PostMapping("/deleteDownStorageCage") |
| | | @ResponseBody |
| | | public Result deleteEdgStorageCage(@RequestBody DownStorageCageDetails downStorageCageDetails) { |
| | | boolean isSucess=downStorageCageDetailsService.updatedownStorageCageDetails(downStorageCageDetails); |
| | | public Result deleteDownStorageCage(@RequestBody DownStorageCageDetails downStorageCageDetails,int downStorageCageId) { |
| | | boolean isSucess=downStorageCageService.updateDownStorageCageDetails(downStorageCageId,downStorageCageDetails); |
| | | return Result.build(200,"删除成功",1); |
| | | } |
| | | |
| | |
| | | package com.mes.downstorage.service; |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface DownStorageCageDetailsService { |
| | | public interface DownStorageCageDetailsService extends MPJBaseService<DownStorageCageDetails> { |
| | | /** |
| | | * @return //添加理片笼内信息 |
| | | */ |
| | |
| | | */ |
| | | boolean updatedownStorageCageDetails(DownStorageCageDetails details); |
| | | |
| | | List<DownStorageCageDetails> getCacheLeisure(); |
| | | // List<DownStorageCageDetails> getCacheLeisure(); |
| | | |
| | | /** |
| | | * @param start |
| | | * @param end |
| | | * @return 根据传入的工位查询符合按照顺序和大小出片的小片 |
| | | */ |
| | | List<DownStorageCageDetails> getCacheOut(int start, int end); |
| | | // List<DownStorageCageDetails> getCacheOut(int start, int end); |
| | | |
| | | /** |
| | | * @return 查询笼子内信息 |
| | | */ |
| | | List<Map> getCacheInfo(); |
| | | List<Map<String, Object>> getCacheInfo(); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param width |
| | | * @return 查询可进此片玻璃的栅格号 找到空格 |
| | | */ |
| | | List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width); |
| | | // List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width); |
| | | |
| | | /** |
| | | * @param start |
| | |
| | | List<DownStorageCageDetails> CacheOut(int start, int end); |
| | | |
| | | /** |
| | | * @return 查询空格子 |
| | | * @return 出片 |
| | | */ |
| | | List<DownStorageCageDetails> selectCacheEmpty2(); |
| | | |
| | | List<DownStorageCageDetails> CacheOut1(int start, int end); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | public interface DownStorageCageService extends MPJBaseService<DownStorageCage> { |
| | | |
| | | |
| | | DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell, String taskType); |
| | | DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell, String taskType); |
| | | // List<Map<String, Object>> selectCacheLeisure(); |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return 进片 |
| | | */ |
| | | boolean processInto(String Number); |
| | | |
| | | |
| | | |
| | | /** |
| | | |
| | | * @return 空格 |
| | | * @return 找到空格子 |
| | | */ |
| | | |
| | | /** |
| | | * @return 出片 |
| | | */ |
| | | boolean processOut(); |
| | | List<DownStorageCageDetails> selectCacheEmpty() ; |
| | | |
| | | /** |
| | | * @param downStorageCage |
| | | * @return 修改理片笼信息 功能:对笼内栅格玻璃 【启用/禁用】 |
| | | */ |
| | | boolean updateDownStorageCage(DownStorageCage downStorageCage); |
| | | |
| | | /** |
| | | /** |
| | | *修改理片笼信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | */ |
| | | boolean updateDownStorageCageDetails(int downStorageCageId,DownStorageCageDetails downStorageCageDetails); |
| | | |
| | | /** |
| | | * @return 查询笼子信息 |
| | | */ |
| | | List<Map<String, Object>> selectDownStorageCages(); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | |
| | | |
| | |
| | | |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.mapper.DownWorkstationMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { |
| | | |
| | | @Autowired |
| | | @Autowired(required = false) |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | | @Autowired |
| | | private GlassInfoMapper glassInfoMapper; |
| | | @Autowired |
| | | private DownWorkstationMapper downWorkstationMapper; |
| | | |
| | | @Override |
| | | public void addDownStorageCageDetails(DownStorageCageDetails details) { |
| | | this.save(details); |
| | |
| | | |
| | | @Override |
| | | //修改理片笼内信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | public boolean updatedownStorageCageDetails(DownStorageCageDetails details){ |
| | | public boolean updatedownStorageCageDetails(DownStorageCageDetails details) { |
| | | baseMapper.updateById(details); |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // @Override |
| | | // public List<DownStorageCageDetails> getCacheOut(int start, int end) { |
| | | // log.info("根据传入的工位查询符合按照顺序和大小出片的小片"); |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // 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") |
| | | // .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") |
| | | // .isNotNull("escd.slot") |
| | | // .between("dw.workstation_id", start, end) |
| | | // .orderByDesc("escd.width") |
| | | // .orderByDesc("escd.height") |
| | | // ); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> getCacheOut(int start, int end) { |
| | | log.info("根据传入的工位查询符合按照顺序和大小出片的小片"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | 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") |
| | | .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") |
| | | .isNotNull("escd.slot") |
| | | .between("dw.workstation_id", start, end) |
| | | .orderByDesc("escd.width") |
| | | .orderByDesc("escd.height") |
| | | ); |
| | | } |
| | | // @Override |
| | | // public List<DownStorageCageDetails> selectCacheEmpty2(){ |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | // .leftJoin("down_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | // .isNull("escd.slot") |
| | | // ); |
| | | // } |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> selectCacheEmpty2(){ |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | .leftJoin("down_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | .isNull("escd.slot") |
| | | public List<Map<String, Object>> getCacheInfo() { |
| | | log.info("查询笼子内信息"); |
| | | return downStorageCageDetailsMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCageDetails.class) // 使用 JoinWrappers.lambda 创建联合查询 |
| | | .selectAll(DownStorageCageDetails.class) // 选择所有字段 |
| | | .eq(DownStorageCage::getSlot, DownStorageCageDetails::getSlot) // 设置关联条件 |
| | | .orderByAsc(DownStorageCage::getSlot) // 按 slot 字段升序排序 |
| | | ); |
| | | } |
| | | |
| | | // |
| | | // @Override |
| | | // public List<Map> getCacheInfo() { |
| | | // log.info(" 查询笼子内信息"); |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // Map.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .orderByAsc("t.slot") |
| | | // ); |
| | | // |
| | | // } |
| | | |
| | | // @Override |
| | | // public List<DownStorageCageDetails> getCacheLeisure() { |
| | | // log.info(" 查询笼子内空闲"); |
| | | // List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .isNull("escd.slot") |
| | | // |
| | | // .orderByAsc("escd.slot") |
| | | // ); |
| | | // return list; |
| | | // } |
| | | |
| | | |
| | | // @Override |
| | | // public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { |
| | | // log.info(" 查询可进此片玻璃的栅格号 找到空格"); |
| | | // |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .isNull("escd.slot") |
| | | // .apply("t.remain_width - " + width + " > 0") |
| | | // .orderByAsc("escd.sequence") |
| | | // ); |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | @Override |
| | | public List<Map> getCacheInfo() { |
| | | log.info(" 查询笼子内信息"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | Map.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .orderByAsc("t.slot") |
| | | ); |
| | | |
| | | } |
| | | public List<DownStorageCageDetails> CacheOut1(int start, int end) { |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> getCacheLeisure() { |
| | | log.info(" 查询笼子内空闲"); |
| | | List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNull("escd.slot") |
| | | |
| | | .orderByAsc("escd.slot") |
| | | ); |
| | | return list; |
| | | } |
| | | List<DownStorageCageDetails> cageDetails = downStorageCageDetailsMapper.selectList(null); |
| | | // Step 5: 判断 down_storage_cage_details 结果数量是否为9,如果是,则执行另外一个查询 |
| | | if (cageDetails.size() == 9) { |
| | | log.info("1、笼子满了的时候,按照笼内版图id 版图片序出"); |
| | | List<DownWorkstation> workstationList = downWorkstationMapper.selectList(new QueryWrapper<DownWorkstation>().between("workstation_id", start, end)); |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { |
| | | log.info(" 查询可进此片玻璃的栅格号 找到空格"); |
| | | List<String> flowCardIds = new ArrayList<>(); |
| | | for (DownWorkstation workstation : workstationList) { |
| | | flowCardIds.add(workstation.getFlowCardId()); |
| | | } |
| | | |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNull("escd.slot") |
| | | .apply("t.remain_width - " + width + " > 0") |
| | | .orderByAsc("escd.sequence") |
| | | ); |
| | | if (flowCardIds.isEmpty()) { |
| | | log.error("未找到对应的 flow_card_id"); |
| | | return Collections.emptyList(); // 返回空列表或者抛出异常,视情况而定 |
| | | } |
| | | LambdaQueryWrapper<DownStorageCageDetails> anotherQueryWrapper = Wrappers.lambdaQuery(); |
| | | |
| | | anotherQueryWrapper.orderByAsc(DownStorageCageDetails::getTemperingLayoutId); |
| | | anotherQueryWrapper.orderByDesc(DownStorageCageDetails::getTemperingFeedSequence); |
| | | anotherQueryWrapper.in(DownStorageCageDetails::getFlowCardId, flowCardIds); |
| | | anotherQueryWrapper.last("LIMIT 1"); |
| | | return downStorageCageDetailsMapper.selectList(anotherQueryWrapper); |
| | | } else { |
| | | |
| | | // Step 1: 查询 DownWorkstation 表获取对应 workstation_id 的 flow_card_id |
| | | List<DownWorkstation> workstationList = downWorkstationMapper.selectList(new QueryWrapper<DownWorkstation>().between("workstation_id", start, end)); |
| | | |
| | | |
| | | List<String> flowCardIds = new ArrayList<>(); |
| | | for (DownWorkstation workstation : workstationList) { |
| | | flowCardIds.add(workstation.getFlowCardId()); |
| | | } |
| | | |
| | | if (flowCardIds.isEmpty()) { |
| | | log.error("2、未找到对应的 flow_card_id"); |
| | | return Collections.emptyList(); // 返回空列表或者抛出异常,视情况而定 |
| | | } |
| | | log.info("流程卡:{}", flowCardIds); |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper2 = Wrappers.lambdaQuery(); |
| | | queryWrapper2.select(GlassInfo::getFlowCardId, |
| | | GlassInfo::getGlassId, |
| | | GlassInfo::getTemperingLayoutId, |
| | | GlassInfo::getTemperingFeedSequence) |
| | | .notInSql(GlassInfo::getGlassId, "SELECT glass_id FROM down_glass_info") |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence) |
| | | .last("LIMIT 1"); |
| | | |
| | | // 查询 GlassInfo 表 |
| | | List<GlassInfo> glassInfos = glassInfoMapper.selectList(queryWrapper2); |
| | | if (glassInfos.isEmpty()) { |
| | | log.error("未找到对应的玻璃信息"); |
| | | return Collections.emptyList(); // 返回空列表或者抛出异常,视情况而定 |
| | | } |
| | | // Step 3: 构造查询 down_storage_cage_details 表的条件 |
| | | List<String> glassIds = glassInfos.stream().map(GlassInfo::getGlassId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<DownStorageCageDetails> cageDetailsQueryWrapper = Wrappers.lambdaQuery(); |
| | | cageDetailsQueryWrapper.in(DownStorageCageDetails::getGlassId, glassIds); |
| | | cageDetailsQueryWrapper.in(DownStorageCageDetails::getFlowCardId, flowCardIds); |
| | | |
| | | log.info("按照流程卡的版图id 版图片序出"); |
| | | // Step 4: 查询 down_storage_cage_details 表并返回结果 |
| | | return downStorageCageDetailsMapper.selectList(cageDetailsQueryWrapper); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.mes.common.PLCAutoMes; |
| | | import com.mes.common.S7control; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { |
| | | @Autowired |
| | | @Autowired(required = false) |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | |
| | | @Autowired |
| | |
| | | private DownGlassTaskService downGlassTaskService; |
| | | @Autowired |
| | | private DownStorageCageDetailsService downStorageCageDetailsService; |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell,String taskType ) { |
| | | @Override |
| | | public DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell, String taskType) { |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | |
| | | BeanUtils.copyProperties(glassInfo,downGlassTask); |
| | | BeanUtils.copyProperties(glassInfo, downGlassTask); |
| | | |
| | | downGlassTask.setStartCell(startCell); |
| | | downGlassTask.setTaskType(taskType); |
| | | downGlassTask.setEndCell(endCell); |
| | | downGlassTask.setTaskType(taskType); |
| | | downGlassTask.setEndCell(endCell); |
| | | return downGlassTask; |
| | | } |
| | | |
| | | |
| | | public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell,String taskType ) { |
| | | @Override |
| | | public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell, String taskType) { |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | |
| | | BeanUtils.copyProperties(glassInfo,downGlassTask); |
| | | BeanUtils.copyProperties(glassInfo, downGlassTask); |
| | | downGlassTask.setStartCell(startCell); |
| | | downGlassTask.setTaskType(taskType); |
| | | downGlassTask.setEndCell(endCell); |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean processInto(String Number) { |
| | | |
| | | //按id查询玻璃信息表里的玻璃 |
| | | GlassInfo GlassInfo = glassInfoService.selectGlassId(Number); |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | //存在此玻璃编号 |
| | | if (GlassInfo != null) { |
| | | //同找到同流程卡附近空格 |
| | | List<DownStorageCageDetails> list = selectCacheEmpty(); |
| | | |
| | | |
| | | |
| | | // list<Map> list=selectCacheEmpty(); |
| | | // list<Map> = downStorageCageService.selectCacheEmpty(); |
| | | if (list.size() > 0) { |
| | | //存在空格 |
| | | //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) |
| | | //2.回复 1进片 |
| | | DownStorageCageDetails item = list.get(0); |
| | | |
| | | //selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId()); |
| | | |
| | | DownGlassTask downGlassTask = createDownGlassTask(GlassInfo,"0",item.getSlot()+"","1"); |
| | | |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); |
| | | |
| | | |
| | | //完成后插入小片数据到缓存表 |
| | | return true; |
| | | } |
| | | |
| | | } else { |
| | | // ID编号不存在 不处理/回复PLC 进行报警提示 |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 理片 出 |
| | | * @return |
| | | */ |
| | | // |
| | | @Override |
| | | public boolean processOut() { |
| | | // 查询任务 |
| | | |
| | | |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | |
| | | List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut(1, 5); |
| | | List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut(6, 10); |
| | | List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut(1, 10); |
| | | //自动绑定架子 |
| | | |
| | | |
| | | |
| | | |
| | | // 优先 超出尺寸优先人工出片 人工处理 |
| | | |
| | | if (!list3.isEmpty()) { |
| | | DownStorageCageDetails item3 = list3.get(0); |
| | | if (item3.getHeight() >= 1 && item3.getWidth() >= 1) { |
| | | |
| | | String endcell = "13"; |
| | | String SendEndcell = "1"; |
| | | |
| | | |
| | | |
| | | DownGlassTask downGlassTask =createDownGlassTask(item3,"0",endcell,"2"); |
| | | |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | // S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); |
| | | // S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | | //如果同时前后端都空闲 优先后端出片并且优先满架 |
| | | else if (!list2.isEmpty()&&!list3.isEmpty()) { |
| | | |
| | | DownStorageCageDetails item3 = list2.get(0); |
| | | String endcell = "11"; |
| | | String SendEndcell = "1"; |
| | | |
| | | DownGlassTask downGlassTask =createDownGlassTask(item3,"0",endcell,"2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | |
| | | } |
| | | // 按照大小符合前端出片 |
| | | else if (!list.isEmpty()) { |
| | | DownStorageCageDetails item = list.get(0); |
| | | |
| | | // 出到 G06 |
| | | |
| | | |
| | | DownGlassTask downGlassTask =createDownGlassTask(item,"0","06","2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | |
| | | // 按照大小符合后端出片 |
| | | } else if (!list2.isEmpty()) { |
| | | DownStorageCageDetails item2 = list2.get(0); |
| | | |
| | | // 出到 G11 |
| | | |
| | | DownGlassTask downGlassTask =createDownGlassTask(item2,"0","11","2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | // 返回结果 |
| | | return false; |
| | | } |
| | | |
| | | |
| | | //找到空格子 |
| | | @Override |
| | | public List<DownStorageCageDetails> selectCacheEmpty() { |
| | | return baseMapper.selectJoinList(DownStorageCageDetails.class, |
| | |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectDownStorageCages() { |
| | | return baseMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCage.class) |
| | | .selectAll(DownStorageCage.class) |
| | | .selectAs(DownStorageCageDetails::getId, "esdId") |
| | | .select(DownStorageCageDetails::getGlassId, DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getId) |
| | | .leftJoin(DownStorageCageDetails.class, on -> on |
| | | .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) |
| | | .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot)) |
| | | ); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改理片笼信息 功能:对笼内栅格玻璃 【启用/禁用】 |
| | | * |
| | | * @param downStorageCage |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateDownStorageCage(DownStorageCage downStorageCage) { |
| | | DownStorageCage downItem = baseMapper.selectById(downStorageCage.getId()); |
| | | downItem.setEnableState(downStorageCage.getEnableState()); |
| | | baseMapper.updateById(downItem); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 修改理片笼信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | * |
| | | * @param downStorageCageId |
| | | * @param downStorageCageDetails |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateDownStorageCageDetails(int downStorageCageId, DownStorageCageDetails downStorageCageDetails) { |
| | | DownStorageCage downItem = baseMapper.selectById(downStorageCageId); |
| | | log.info("正常" + downItem); |
| | | if (downStorageCageDetails != null) { |
| | | DownStorageCageDetails edgDItem = downStorageCageDetailsMapper.selectById(downStorageCageDetails.getId()); |
| | | //添加 |
| | | if (edgDItem != null) { |
| | | //只传格子 :移除玻璃 |
| | | DownStorageCageDetails newresult = downStorageCageDetailsMapper.selectById(downStorageCageDetails.getId()); |
| | | newresult.setSlot(downItem.getSlot()); |
| | | downStorageCageDetailsMapper.updateById(newresult); |
| | | } |
| | | } |
| | | |
| | | if (downItem != null) { |
| | | //移除 |
| | | DownStorageCageDetails result = downStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<DownStorageCageDetails>().eq(DownStorageCageDetails::getSlot, downStorageCageId)); |
| | | if (result != null) { |
| | | result.setSlot(0); |
| | | downStorageCageDetailsMapper.updateById(result); |
| | | } |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | @GetMapping("/getone") |
| | | public ResponseEntity<?> getOneDownWorkstations() { |
| | | try { |
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,5); |
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6); |
| | | // 构建符合预期格式的响应数据 |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | | responseData.put("code", 200); |
| | |
| | | private Integer workState; |
| | | |
| | | |
| | | /** |
| | | * 总数量 |
| | | */ |
| | | @TableField("total_quantity") |
| | | private Integer totalquantity; |
| | | |
| | | /** |
| | | * 落架数量 |
| | | */ |
| | | @TableField("racks_number") |
| | | private Integer Racksnumber; |
| | | |
| | |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 玻璃 |
| | | * 玻璃ID |
| | | */ |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 工位id |
| | | */ |
| | | private String workstationid; |
| | | |
| | | /** |
| | | * 机器人 |
| | | */ |
| | | private String Robot; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import org.mapstruct.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | |
| | | @DS("salve_hangzhoumes") |
| | | @Mapper |
| | | public interface DownWorkstationTaskMapper extends BaseMapper<DownWorkstationTask> { |
| | | |
| | | List<DownWorkstationTask> selectList(); |
| | |
| | | */ |
| | | int updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId); |
| | | |
| | | void insertdownglassinfo(); |
| | | |
| | | |
| | | /** |
| | | * @return // |
| | | * 工位显示 |
| | | */ |
| | | List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(); |
| | | |
| | | |
| | | /** |
| | | * @param flowcardid |
| | | * 根据流程卡号查询 |
| | | * @return |
| | | */ |
| | | DownWorkstation selectByFlowCardId(String flowcardid); |
| | | } |
| | |
| | | /** |
| | | * @param downGlassInfo 插入任务 |
| | | */ |
| | | void insertdownWorkstationtask(DownGlassInfo downGlassInfo); |
| | | void insertdownWorkstationtask(DownGlassInfo downGlassInfo,String workstationid); |
| | | |
| | | /** |
| | | * @param Id 更新任务状态 |
| | | * @param downWorkstationTask 更新任务状态 |
| | | */ |
| | | void updateTaskStateToZero(long Id); |
| | | void updateTaskState(DownWorkstationTask downWorkstationTask); |
| | | |
| | | /** |
| | | * @return 获取任务状态为1的信息 |
| | | */ |
| | | List<DownWorkstationTask> getTaskState(); |
| | | |
| | | void deleteTask(DownWorkstationTask downWorkstationTask); |
| | | } |
| | |
| | | |
| | | @Autowired |
| | | private DownWorkstationMapper downWorkstationMapper; |
| | | @Autowired |
| | | @Autowired(required=false) |
| | | private DownWorkstationTaskMapper downWorkstationTaskMapper; |
| | | @Autowired |
| | | private DownGlassInfoService downGlassInfoService; |
| | |
| | | //获取总数量 |
| | | @Override |
| | | public int getTotalQuantity(int workstationId) { |
| | | QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("total_quantity") |
| | | .eq("workstation_id", workstationId); |
| | | DownWorkstation result = baseMapper.selectOne(new QueryWrapper<DownWorkstation>().lambda() |
| | | .select(DownWorkstation::getTotalquantity) |
| | | .eq(DownWorkstation::getWorkstationId, workstationId)); |
| | | |
| | | DownWorkstation result = baseMapper.selectOne(queryWrapper); |
| | | return result != null ? result.getTotalquantity() : 0; |
| | | } |
| | | |
| | | |
| | | //工位显示 |
| | | @Override |
| | |
| | | .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id") |
| | | .groupBy("t.workstation_id", "t.flow_card_id"); |
| | | |
| | | // List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper); |
| | | List<DownWorkstionAndDownGlassinfo> workstationList = null; |
| | | List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper); |
| | | // List<DownWorkstionAndDownGlassinfo> workstationList = null; |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (DownWorkstionAndDownGlassinfo downWorkstionAndDownGlassinfo : workstationList) { |
| | | Map<String, Object> rack = new HashMap<>(); |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public DownWorkstation selectByFlowCardId(String flowcardid) { |
| | | QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("flow_card_id", flowcardid); |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void insertdownglassinfo() { |
| | | |
| | | |
| | | List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState(); |
| | | // |
| | | |
| | | |
| | | if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) { |
| | | |
| | | // |
| | | |
| | | for (DownGlassTask downGlassInfo : taskdownGlassInf) { |
| | | // 创建新的 DownGlassInfo 对象并设置相关属性 |
| | | DownGlassInfo newdownGlassInfo = new DownGlassInfo(); |
| | | |
| | | newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId()); |
| | | Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId()); |
| | | // 初始化顺序字段值 |
| | | int sequence = maxSequence != null ? maxSequence + 1 : 1; |
| | | // newdownGlassInfo.setId(downGlassInfo.getId()); |
| | | newdownGlassInfo.setWidth(downGlassInfo.getWidth()); |
| | | newdownGlassInfo.setHeight(downGlassInfo.getHeight()); |
| | | newdownGlassInfo.setThickness(downGlassInfo.getThickness()); |
| | | newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid()); |
| | | // 设置顺序字段值 |
| | | newdownGlassInfo.setSequence(sequence); |
| | | |
| | | // 插入数据到下片玻璃信息表 |
| | | downGlassInfoService.insertDownGlassInfo(newdownGlassInfo); |
| | | //插入数据到机械手任务表 |
| | | |
| | | downWorkstationTaskService.insertdownWorkstationtask(newdownGlassInfo); |
| | | //更新下片任务表状态为0 |
| | | downGlassTaskService.updateTaskStateToZero(downGlassInfo.getId()); |
| | | //删除下片任务表中的记录 |
| | | downGlassTaskService.deleteTask(downGlassInfo.getFlowCardId()); |
| | | |
| | | sequence++; // 递增顺序字段值 |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | try { |
| | | //查询下片工位表中架子是否绑定了流程卡号 工位表和任务表中状态为1的流程卡号和已落架数量 |
| | | List<DownWorkstationTask> taskdownWorkstation = downWorkstationTaskService.getTaskState(); |
| | | if (taskdownWorkstation != null && !taskdownWorkstation.isEmpty()) { |
| | | //,如果已经绑定则更新已落架数量,并且删除下片任务表中的记录 |
| | | for (DownWorkstationTask downWorkstation : taskdownWorkstation) { |
| | | //更新下片工位表中已落架数量 |
| | | DownWorkstation downWorkstation1 = selectByFlowCardId(downWorkstation.getFlowCardId()); |
| | | updateracksnumber(downWorkstation.getFlowCardId(), downWorkstation1.getRacksnumber() + 1); |
| | | //更新机械任务表中状态为0 |
| | | downWorkstationTaskService.updateTaskStateToZero(downWorkstation.getId()); |
| | | //删除机械任务表 |
| | | downWorkstationTaskService.removeById(downWorkstation.getId()); |
| | | |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | // 打印异常信息 |
| | | e.printStackTrace(); |
| | | // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息 |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.downworkstation.service.impl; |
| | | |
| | | 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.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | |
| | | public class DownWorkstationTaskServiceImpl extends ServiceImpl<DownWorkstationTaskMapper, DownWorkstationTask> implements DownWorkstationTaskService { |
| | | |
| | | |
| | | public void insertdownWorkstationtask(DownGlassInfo downGlassInfo) { |
| | | public void insertdownWorkstationtask(DownGlassInfo downGlassInfo,String workstationid) { |
| | | DownWorkstationTask entity = new DownWorkstationTask(); |
| | | // 查询当前最大的 id 值 |
| | | Long maxId = getMaxId(); |
| | |
| | | Long newId = (maxId == null) ? 1 : maxId + 1; |
| | | |
| | | |
| | | BeanUtils.copyProperties(entity,downGlassInfo); |
| | | BeanUtils.copyProperties(downGlassInfo,entity); |
| | | entity.setId(newId); // 设置手动递增的 id |
| | | entity.setState(1); |
| | | entity.setWorkstationid(workstationid); |
| | | baseMapper.insert(entity); |
| | | } |
| | | |
| | |
| | | queryWrapper.eq("state", 1); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | @Override |
| | | public void updateTaskStateToZero(long id) { |
| | | UpdateWrapper<DownWorkstationTask> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("state", 0).eq("id", id); |
| | | |
| | | baseMapper.update(new DownWorkstationTask(), updateWrapper); |
| | | @Override |
| | | public void updateTaskState(DownWorkstationTask downWorkstationTask) { |
| | | LambdaUpdateWrapper<DownWorkstationTask> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | |
| | | lambdaUpdateWrapper.set(DownWorkstationTask::getState, 2) |
| | | .eq(DownWorkstationTask::getGlassId, downWorkstationTask.getGlassId()); |
| | | |
| | | baseMapper.update(new DownWorkstationTask(), lambdaUpdateWrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deleteTask(DownWorkstationTask downWorkstationTask) { |
| | | LambdaQueryWrapper<DownWorkstationTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DownWorkstationTask::getGlassId, downWorkstationTask.getGlassId()); |
| | | |
| | | baseMapper.delete(queryWrapper); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | /** |
| | | * @param flowCardId |
| | | * @return 根据流程卡号查询玻璃信息 |
| | | */ |
| | | int getGlassInfoCountByFlowCardId(String flowCardId); |
| | | |
| | | /** |
| | | * @return |
| | | * 查询所有不同流程卡号 |
| | | */ |
| | | List<Map<String, Object>> getFlowCardId(); |
| | | |
| | | /** |
| | | * @param id |
| | | * @return 根据玻璃id查询玻璃信息 |
| | | */ |
| | | GlassInfo selectGlassId(String id); |
| | | // List<GlassInfo> getmaxglass(GlassInfo glassInfo); |
| | | } |
| | |
| | | |
| | | private GlassInfoMapper glassInfoMapper; |
| | | |
| | | @Autowired |
| | | @Autowired(required=false) |
| | | public GlassInfoServiceImpl(GlassInfoMapper glassInfoMapper) { |
| | | this.glassInfoMapper = glassInfoMapper; |
| | | } |
| | | |
| | | @Override |
| | | public int getGlassInfoCountByFlowCardId(String flowCardId) { |
| | | QueryWrapper<GlassInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("flow_card_id", flowCardId); |
| | | |
| | | return baseMapper.selectCount(queryWrapper); |
| | | return baseMapper.selectCount(new QueryWrapper<GlassInfo>().lambda() |
| | | .eq(GlassInfo::getFlowCardId, flowCardId)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getFlowCardId() { |
| | | return baseMapper.selectMaps(new QueryWrapper<GlassInfo>().select("DISTINCT flow_card_id")); |
| | | return baseMapper.selectMaps(new QueryWrapper<GlassInfo>().lambda().select(GlassInfo::getFlowCardId).groupBy(GlassInfo::getFlowCardId)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public GlassInfo selectGlassId(String id) { |
| | | QueryWrapper<GlassInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("glass_id", id); |
| | | |
| | | return baseMapper.selectOne(queryWrapper); |
| | | return baseMapper.selectOne(new QueryWrapper<GlassInfo>().lambda() |
| | | .eq(GlassInfo::getGlassId, id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.downworkstation.service.DownWorkstationTaskService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/5/8 8:17 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class DownCacheGlassTask { |
| | | |
| | | |
| | | @Autowired |
| | | DownGlassTaskService downGlassTaskService; |
| | | @Autowired |
| | | GlassInfoService glassInfoService; |
| | | @Autowired |
| | | DownStorageCageDetailsService downStorageCageDetailsService; |
| | | @Autowired |
| | | DownStorageCageService downStorageCageService; |
| | | @Autowired |
| | | DownWorkstationService downWorkstationService; |
| | | @Autowired |
| | | DownGlassInfoService downGlassInfoService; |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private DownWorkstationTaskService downWorkstationTaskService; |
| | | |
| | | // @Value("${mes.threshold}") |
| | | private int threshold; |
| | | |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void plcdownGlassTask() { |
| | | // PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | // String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue(); |
| | | // String glassIdeValue = plcParameterObject.getPlcParameter("A05_scanning_ID").getValue(); |
| | | // String confirmationWrodValue = plcParameterObject.getPlcParameter("MES_confirmation_word").getValue(); |
| | | // String outGlassstate = plcParameterObject.getPlcParameter("A09_glass_status").getValue(); |
| | | // String confirmationWrodAddress = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress(); |
| | | // String G06RobotTaskRequestWord = plcParameterObject.getPlcParameter("G06RobotTaskRequestWord").getAddress(); |
| | | |
| | | |
| | | String taskRequestTypeValue ="3"; |
| | | String glassIdeValue ="NG24041101C002-2-6-1-6"; |
| | | String confirmationWrodValue ="1"; |
| | | String outGlassstate="1"; |
| | | String confirmationWrodAddress="1"; |
| | | String G11RobotTaskRequestWord ="1"; |
| | | String G06RobotTaskRequestWord ="1"; |
| | | String G13RobotTaskRequestWord ="1"; |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态为:{}", |
| | | taskRequestTypeValue, glassIdeValue, confirmationWrodValue, outGlassstate); |
| | | |
| | | // if ("0".equals(taskRequestTypeValue)) { |
| | | // if ("0".equals(confirmationWrodValue)) { |
| | | // log.info("2、获取到的请求字为0,且确认字为0,不执行任务"); |
| | | // return; |
| | | // } |
| | | // log.info("2、获取到的请求字为0,将确认字改为0"); |
| | | // S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 0); |
| | | // return; |
| | | // } |
| | | // if (!"0".equals(confirmationWrodValue)) { |
| | | // log.info("2、获取到的请求字不为0,将确认字改为0"); |
| | | // S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 0); |
| | | // return; |
| | | // } |
| | | |
| | | if ("1".equals(taskRequestTypeValue)) { |
| | | log.info("3、进片请求,且确认字为0,执行进片任务"); |
| | | inTo(glassIdeValue, confirmationWrodAddress); |
| | | } else if ("2".equals(taskRequestTypeValue)) { |
| | | |
| | | log.info("3、出片请求,且确认字为0,执行进片任务"); |
| | | outTo( confirmationWrodAddress); |
| | | |
| | | } else if ("3".equals(taskRequestTypeValue)) { |
| | | log.info("3、进片和出片都空闲,执行出片任务"); |
| | | if (outTo(confirmationWrodAddress)) { |
| | | inTo(glassIdeValue, confirmationWrodAddress); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | if (("1".equals(G11RobotTaskRequestWord) || "1".equals(G06RobotTaskRequestWord)) || "1".equals(G13RobotTaskRequestWord)) { |
| | | log.info("4、有机器人下片请求,执行下片任务"); |
| | | insertdownglassinfo(); |
| | | } |
| | | |
| | | //自动绑定架子,如果工位表没有绑定架子,默认将笼子中数量最多的流程卡号绑定机器手2的空架子 |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 进片任务 |
| | | * @param glassId |
| | | * @param confirmationWrodAddress |
| | | * @param |
| | | */ |
| | | private void inTo(String glassId, String confirmationWrodAddress) { |
| | | log.info("1、按照玻璃id:{}获取玻璃小片信息", glassId); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | if (glassInfo == null) { |
| | | log.info("2、此玻璃编号不存在"); |
| | | return; |
| | | } |
| | | log.info("2、获取到的玻璃信息为{}", glassInfo); |
| | | //添加进片任务 查找空格 |
| | | List<DownStorageCageDetails> list = downStorageCageService.selectCacheEmpty(); |
| | | if(list.size()>0){ |
| | | DownStorageCageDetails item = list.get(0); |
| | | |
| | | |
| | | |
| | | log.info("3、查询卧式理片笼里面的空格:{}", list); |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | DownStorageCageDetails details = new DownStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(1); |
| | | details.setGlassId(glassInfo.getGlassId()); |
| | | details.setSlot(item.getSlot()); |
| | | details.setDeviceId(item.getDeviceId()); |
| | | downStorageCageDetailsService.save(details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", item.getSlot() + "", "1"); |
| | | //添加进片任务 |
| | | log.info("6、生成进片任务信息存入任务表{}", downGlassTask); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | } |
| | | //S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | log.info("7、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 出片任务 |
| | | * |
| | | * @param confirmationWrodAddress |
| | | * |
| | | */ |
| | | private Boolean outTo( String confirmationWrodAddress) { |
| | | log.info("单片情况根据传入的料架号 查询符合按照版图id和片序出片,并且优先出满架的小片"); |
| | | List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut1(1,3); |
| | | |
| | | List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut1(4,6); |
| | | |
| | | List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut1(1,6); |
| | | // 优先 超出尺寸优先人工出片 人工处理 |
| | | if (!list3.isEmpty()) { |
| | | |
| | | DownStorageCageDetails item3 = list3.get(0); |
| | | if (item3.getHeight() >= 2500 && item3.getWidth() >= 2660) { |
| | | log.info("人工处理"); |
| | | String endcell = "7"; |
| | | |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item3, "9", endcell, "2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | // S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2); |
| | | |
| | | return true; |
| | | } |
| | | else if (!list2.isEmpty() && !list3.isEmpty()) { |
| | | log.info("前后端都空闲 优先后端出片并且优先满架"); |
| | | DownStorageCageDetails item4 = list2.get(0); |
| | | |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item4.getFlowCardId())); |
| | | String endcell = String.valueOf(downWorkstation.getWorkstationId()); |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item4, "9", endcell, "2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | //S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2); |
| | | |
| | | return true; |
| | | |
| | | } |
| | | // 按照版图id和片序符合前端出片 |
| | | else if (!list.isEmpty()) { |
| | | log.info("前端出片"); |
| | | DownStorageCageDetails item = list.get(0); |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item.getFlowCardId())); |
| | | String endcell = String.valueOf(downWorkstation.getWorkstationId()); |
| | | // 出到 G06 |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item, "9", endcell, "2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | // S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2); |
| | | |
| | | |
| | | return true; |
| | | // 按照版图id和片序符合后端出片 |
| | | } else if (!list2.isEmpty()) { |
| | | log.info("后端出片"); |
| | | DownStorageCageDetails item2 = list2.get(0); |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item2.getFlowCardId())); |
| | | String endcell = String.valueOf(downWorkstation.getWorkstationId()); |
| | | // 出到 G11 |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item2, "9", endcell, "2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | // S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2); |
| | | return true; |
| | | } |
| | | } |
| | | //如果同时前后端都空闲 优先后端出片并且优先满架 |
| | | |
| | | // 返回结果 |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // |
| | | public void insertdownglassinfo() { |
| | | try { |
| | | |
| | | List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState(); |
| | | if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) { |
| | | |
| | | for (DownGlassTask downGlassInfo : taskdownGlassInf) { |
| | | // 创建新的 DownGlassInfo 对象并设置相关属性 |
| | | DownGlassInfo newdownGlassInfo = new DownGlassInfo(); |
| | | |
| | | Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId()); |
| | | // 初始化顺序字段值 |
| | | int sequence = maxSequence != null ? maxSequence + 1 : 1; |
| | | BeanUtils.copyProperties(downGlassInfo, newdownGlassInfo); |
| | | // 设置顺序字段值 |
| | | newdownGlassInfo.setSequence(sequence); |
| | | // 插入数据到下片玻璃信息表 |
| | | downGlassInfoService.insertDownGlassInfo(newdownGlassInfo); |
| | | log.info("插入数据到下片玻璃信息表"); |
| | | DownWorkstation downWorkstation1 = downWorkstationService.selectByFlowCardId(downGlassInfo.getFlowCardId()); |
| | | downWorkstationService.updateracksnumber(downGlassInfo.getFlowCardId(), downWorkstation1.getRacksnumber() + 1); |
| | | log.info("更新落架数量"); |
| | | sequence++; // 递增顺序字段值 |
| | | |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | // 打印异常信息 |
| | | e.printStackTrace(); |
| | | // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息 |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public class ExcelToJsonConverter { |
| | | |
| | | public static void main(String[] args) { |
| | | String excelFilePath = "src/main/resources/JsonFile/alarm.xlsx"; |
| | | String excelFilePath = "src/main/resources/JsonFile/PlcdownGlass.xlsx"; |
| | | String sheetName = "Sheet1"; |
| | | int addressColumnIndex = 0; |
| | | int nameColumnIndex = 1; |
| | | |
| | | //int unitColumnIndex = 2; |
| | | String outputFilePath = "src/main/resources/JsonFile/PlcAlarm.json"; |
| | | String outputFilePath = "src/main/resources/JsonFile/PlcdownGlass.json"; |
| | | |
| | | try (Workbook workbook = new XSSFWorkbook(new FileInputStream(excelFilePath))) { |
| | | Sheet sheet = workbook.getSheet(sheetName); |
| | |
| | | LinkedHashMap<String, Object> resultObject = new LinkedHashMap<>(); |
| | | resultObject.put("plcAddressBegin", "DB100.0"); |
| | | resultObject.put("plcAddressLenght", String.valueOf(plcAddressLength)); |
| | | // resultObject.put("dataType", "word"); |
| | | resultObject.put("dataType", "bit"); |
| | | resultObject.put("dataType", "word"); |
| | | // resultObject.put("dataType", "bit"); |
| | | resultObject.put("parameteInfor", jsonList); |
| | | |
| | | Gson gson = new Gson(); |
New file |
| | |
| | | {
|
| | | "plcAddressBegin": "DB100.0",
|
| | | "plcAddressLenght": "142",
|
| | | "dataType": "word",
|
| | | "parameteInfor": [
|
| | | {
|
| | | "codeId": "RequestWord",
|
| | | "addressIndex": "0",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G04ID",
|
| | | "addressIndex": "2",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G06RobotTaskRequestWord",
|
| | | "addressIndex": "4",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G06ID",
|
| | | "addressIndex": "6",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G11RobotTaskRequestWord",
|
| | | "addressIndex": "8",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G011ID",
|
| | | "addressIndex": "10",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "12",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "14",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "16",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "18",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "MESSendingWord",
|
| | | "addressIndex": "20",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InputGrid",
|
| | | "addressIndex": "22",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "OutputGrid",
|
| | | "addressIndex": "24",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "OutputID",
|
| | | "addressIndex": "26",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "FrontOrRearLowerSlice",
|
| | | "addressIndex": "28",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "30",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G06RobotTaskReply",
|
| | | "addressIndex": "32",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G06Rack",
|
| | | "addressIndex": "34",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G11RobotTaskReply",
|
| | | "addressIndex": "36",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G11Rack",
|
| | | "addressIndex": "38",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "40",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "42",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "44",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "46",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "48",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "50",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "52",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "54",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "MESTaskState",
|
| | | "addressIndex": "56",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "58",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "AlarmState",
|
| | | "addressIndex": "60",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "Alarm1",
|
| | | "addressIndex": "62",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "Alarm2",
|
| | | "addressIndex": "64",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "Alarm3",
|
| | | "addressIndex": "66",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "Alarm4",
|
| | | "addressIndex": "68",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "neirong",
|
| | | "addressIndex": "70",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "device",
|
| | | "addressIndex": "72",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "74",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "76",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut1",
|
| | | "addressIndex": "78",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut2",
|
| | | "addressIndex": "80",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut3",
|
| | | "addressIndex": "82",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut4",
|
| | | "addressIndex": "84",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut5",
|
| | | "addressIndex": "86",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut6",
|
| | | "addressIndex": "88",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "InOut7",
|
| | | "addressIndex": "90",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "92",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "94",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "96",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "98",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "spare",
|
| | | "addressIndex": "100",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G04ActionState",
|
| | | "addressIndex": "102",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G05ActionState",
|
| | | "addressIndex": "104",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G06ActionState",
|
| | | "addressIndex": "106",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G07ActionState",
|
| | | "addressIndex": "108",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G08ActionState",
|
| | | "addressIndex": "110",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G09ActionState",
|
| | | "addressIndex": "112",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G10ActionState",
|
| | | "addressIndex": "114",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G11ActionState",
|
| | | "addressIndex": "116",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G12ActionState",
|
| | | "addressIndex": "118",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G13ActionState",
|
| | | "addressIndex": "120",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G04IDS",
|
| | | "addressIndex": "122",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G05IDS",
|
| | | "addressIndex": "124",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G06IDS",
|
| | | "addressIndex": "126",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G07IDS",
|
| | | "addressIndex": "128",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G08IDS",
|
| | | "addressIndex": "130",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G09IDS",
|
| | | "addressIndex": "132",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G10IDS",
|
| | | "addressIndex": "134",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G11IDS",
|
| | | "addressIndex": "136",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G12IDS",
|
| | | "addressIndex": "138",
|
| | | "addressLenght": "2"
|
| | | },
|
| | | {
|
| | | "codeId": "G13ID",
|
| | | "addressIndex": "140",
|
| | | "addressLenght": "2"
|
| | | }
|
| | | ]
|
| | | } |
| | |
| | | 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 |
| | |
| | | |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.downworkstation.service.impl.DownWorkstationServiceImpl; |
| | | import com.mes.glassinfo.service.impl.GlassInfoServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | DownStorageCageDetailsService downStorageCageDetailsService; |
| | | @Autowired |
| | | DownWorkstationServiceImpl downWorkstationServiceImpl; |
| | | @Autowired |
| | | GlassInfoServiceImpl glassInfoServiceImpl; |
| | | @Autowired |
| | | DownWorkstationService downWorkstationService; |
| | | |
| | | @Test |
| | | public void testFindPath() { |
| | |
| | | |
| | | @Test |
| | | public void testCacheGlass() { |
| | | List<Map> map = downStorageCageDetailsServiceImpl.getCacheInfo(); |
| | | log.info("笼内信息:{}", Arrays.asList(map)); |
| | | //List<Map<String, Object>> map = downStorageCageServiceImpl.selectDownStorageCages(); |
| | | // log.info("笼内信息:{}", Arrays.asList(map)); |
| | | downStorageCageServiceImpl.updateDownStorageCageDetails(1,null); |
| | | } |
| | | |
| | | @Test |
| | | public void testselectCacheEmpty() { |
| | | List<DownStorageCageDetails> map = downStorageCageDetailsServiceImpl.getCacheLeisure(); |
| | | log.info("笼内空格:{}", Arrays.asList(map)); |
| | | // List<DownStorageCageDetails> map = downStorageCageDetailsServiceImpl.getCacheLeisure(); |
| | | // log.info("笼内空格:{}", Arrays.asList(map)); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testgetCacheOut() { |
| | | List<DownStorageCageDetails> map = downStorageCageDetailsServiceImpl.getCacheOut(1, 5); |
| | | log.info("根据传入的工位查询符合按照顺序和大小出片的小片:{}", Arrays.asList(map)); |
| | | // List<DownStorageCageDetails> map = downStorageCageDetailsServiceImpl.getCacheOut(1, 5); |
| | | // log.info("根据传入的工位查询符合按照顺序和大小出片的小片:{}", Arrays.asList(map)); |
| | | } |
| | | |
| | | |
| | |
| | | @Test |
| | | public void testplc() { |
| | | log.info("测试"); |
| | | downWorkstationServiceImpl.insertdownglassinfo(); |
| | | glassInfoServiceImpl.getGlassInfoCountByFlowCardId("NG24030702A01"); |
| | | |
| | | } |
| | | |
| | |
| | | @Test |
| | | public void testin2() { |
| | | log.info("测试进片"); |
| | | downStorageCageDetailsServiceImpl.getIsExistIntoCacheByflowcardid("NG2023005",500); |
| | | //downStorageCageDetailsServiceImpl.getIsExistIntoCacheByflowcardid("NG2023005",500); |
| | | |
| | | } |
| | | |
| | |
| | | @Test |
| | | public void selectCacheEmpty() { |
| | | log.info("测试进片"); |
| | | downStorageCageDetailsServiceImpl.getCacheLeisure(); |
| | | //downStorageCageDetailsServiceImpl.getCacheLeisure(); |
| | | |
| | | } |
| | | |
| | | @Test |
| | | public void CacheEmpty() { |
| | | log.info("测试出片"); |
| | | downStorageCageDetailsService.CacheOut(1,10); |
| | | downStorageCageDetailsService.CacheOut(1,2); |
| | | |
| | | } |
| | | @Test |
| | | public void CacheEmpty1() { |
| | | log.info("测试出片"); |
| | | downStorageCageDetailsServiceImpl.CacheOut1(1,6); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Test |
| | | public void getTotalGlassDimensionsByWorkstation() { |
| | | log.info("工位显示"); |
| | | downWorkstationServiceImpl.getTotalGlassDimensionsByWorkstation(); |
| | | downWorkstationService.getTotalGlassDimensionsByWorkstation(); |
| | | |
| | | } |
| | | |
| | |
| | | public void updateTaskStateToZero() { |
| | | log.info("更新状态0"); |
| | | |
| | | downGlassTaskServiceImpl.updateTaskStateToZero(3); |
| | | downGlassTaskServiceImpl.updateTaskState("3"); |
| | | } |
| | | |
| | | |