UI-Project/src/views/StockBasicData/stockBasicData.vue
@@ -110,6 +110,70 @@ }); tableData.value = formattedTasks }; // 模拟数据 // const generateMockData = () => { // const mockList = [ // { // glassId: 'GL251209001', // width: 520, // height: 310, // thickness: 10, // filmsid: '钢化玻璃', // line: 1, // state: 2, // 未磨边 // createTime: Date.now() - 3600 * 1000 * 2, // 2小时前的时间戳 // formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 2) // }, // { // glassId: 'GL251209002', // width: 600, // height: 380, // thickness: 12, // filmsid: '浮法玻璃', // line: 2, // state: 1, // 磨边中 // createTime: Date.now() - 3600 * 1000 * 1, // 1小时前的时间戳 // formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 1) // }, // { // glassId: 'GL251209003', // width: 480, // height: 290, // thickness: 8, // filmsid: '夹胶玻璃', // line: 1, // state: 1, // 已磨边 // createTime: Date.now() - 3600 * 1000 * 6, // 6小时前的时间戳 // formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 6) // }, // { // glassId: 'GL251209004', // width: 550, // height: 330, // thickness: 9, // filmsid: '中空玻璃', // line: 2, // state: 0, // createTime: Date.now() - 3600 * 1000 * 3, // formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 3) // }, // { // glassId: 'GL251209005', // width: 580, // height: 350, // thickness: 11, // filmsid: '防弹玻璃', // line: '1', // state: 0, // createTime: Date.now() - 3600 * 1000 * 4, // formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 4) // } // ]; // return mockList; // }; // tableData.value = generateMockData(); // ElMessage.success('模拟数据加载成功!'); // 历史任务 const iframeUrl = ref(''); const handlehistorical = (row) => { @@ -124,16 +188,94 @@ closeWebSocket(socket); } }); function getStatusTypeb(state) { switch (state) { case 0: return 'info'; case 1: return 'success'; case 1: return 'danger'; // function getStatusTypeb(state) { // switch (state) { // case 0: // return 'info'; // case 1: // return 'success'; // case 1: // return 'danger'; // } // } // 1. 辅助:获取行真实索引 function getRowRealIndex(row) { return tableData.value.findIndex(item => item.glassId === row.glassId); } // 2. 辅助:获取指定线路最新行状态 function getLineLatestState(line) { const targetLine = String(line || '').trim(); if (!targetLine) return -1; for (const row of tableData.value) { const rowLine = String(row.line || '').trim(); if (rowLine === targetLine) { return Number(row.state); } } return -1; } // 3. 核心判断:是否需要高亮/标红 function isNeedHighlight(row) { const currentState = Number(row.state); const currentLine = String(row.line || '').trim(); if (!currentLine) return false; // 原有逻辑:未磨边 + 前序有磨边中/已磨边 if (currentState === 0) { const currentIndex = getRowRealIndex(row); if (currentIndex === -1) return false; for (let i = 0; i < currentIndex; i++) { const compareRow = tableData.value[i]; const compareLine = String(compareRow?.line || '').trim(); const compareState = Number(compareRow?.state); if (compareLine === currentLine && [1, 2].includes(compareState)) { return true; } } } // 新增逻辑:磨边中 + 同线路最新是已磨边 if (currentState === 1) { const latestState = getLineLatestState(currentLine); if (latestState === 2) { return true; } } return false; } // 4. 原始颜色映射 function getOriginalColor(state) { const stateNum = Number(state); switch (stateNum) { case 0: return 'info'; case 1: return 'success'; case 2: return 'primary'; default: return 'info'; } } // 5. 标签类型函数(调用isNeedHighlight) function getStatusTypeb(row) { const currentState = Number(row.state); if ([0, 1].includes(currentState) && isNeedHighlight(row)) { return 'danger'; } return getOriginalColor(row.state); } // 6. 行样式函数(调用isNeedHighlight) function getTableRowClass({ row }) { const currentState = Number(row.state); if ([0, 1].includes(currentState) && isNeedHighlight(row)) { return 'leak-edge-highlight'; } return ''; } function getStatusTextb(state) { switch (state) { case 0: @@ -189,7 +331,9 @@ <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> <el-table height="750" ref="table" @selection-change="handleSelectionChange" :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" :row-class-name="getTableRowClass" > <el-table-column prop="glassId" align="center" :label="$t('workOrder.glassID')" min-width="180" /> <el-table-column prop="width" align="center" :label="$t('workOrder.width')" min-width="120" /> <el-table-column prop="height" align="center" :label="$t('workOrder.height')" min-width="80" /> @@ -201,10 +345,13 @@ <!-- <template #default="scope"> {{ scope.row.status==0?"未磨边":scope.row.status==1?"磨边中":"已磨边" }} </template> --> <template #default="scope"> <el-tag :type="getStatusTypeb(scope.row.state)"> <template #default="scope"> <el-tag :type="getStatusTypeb(scope.row || {}, scope.index)"> {{ getStatusTextb(scope.row.state) }} </el-tag> </el-tag> <!-- <el-tag :type="getStatusTypeb(scope.row.state)"> {{ getStatusTextb(scope.row.state) }} </el-tag> --> </template> </el-table-column> <el-table-column fixed="right" :label="$t('workOrder.operate')" align="center" width="200"> @@ -256,4 +403,17 @@ height: 460px; /* margin-top: -60px; */ } /* 漏磨边行整行高亮样式(穿透scoped) */ :deep(.leak-edge-highlight) { background-color: #fff1f0 !important; /* 浅红背景(和danger标签呼应) */ } /* 行内单元格文字标红 */ :deep(.leak-edge-highlight > td) { color: #f5222d !important; /* 红色文字 */ font-weight: 500 !important; /* 可选:文字加粗,更醒目 */ } /* 鼠标悬浮时保持高亮(可选) */ :deep(.el-table__row.leak-edge-highlight:hover > td) { background-color: #fee2e2 !important; } </style> hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/TemperingGlassInfoService.java
@@ -81,4 +81,6 @@ List<PieChartVO> queryPieChart(); List<TemperingGlassInfo> queryEngineerAndLayoutId(); boolean saveBatch(List<TemperingGlassInfo> list); } hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
@@ -212,4 +212,10 @@ public List<TemperingGlassInfo> queryEngineerAndLayoutId() { return baseMapper.queryEngineerAndLayoutId(); } @Override public boolean saveBatch(List<TemperingGlassInfo> list) { log.info("需要钢化的玻璃为:{}", list); return baseMapper.saveBatch(list); } } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/menu/controller/SysMenuController.java
@@ -30,21 +30,18 @@ @ApiOperation("新增菜单") @PostMapping("/save") // @PreAuthorize("hasAuthority('sys:menu:save')") public Result save(@Validated @RequestBody SysMenu sysMenu) { sysMenuService.save(sysMenu); GeneralRequest request = new GeneralRequest(); return Result.success(sysMenuService.getMenuTree(request)); public Result saveMenu(@Validated @RequestBody SysMenu sysMenu) { sysMenuService.saveMenu(sysMenu); return Result.build(200, "新增成功", Boolean.TRUE); } @ApiOperation("修改菜单信息") @PostMapping("/updateMenu") // @PreAuthorize("hasAuthority('sys:menu:update')") public Result<List<SysMenu>> updateMenu(@Validated @RequestBody SysMenu sysMenu) { //return Result.success(sysMenu); public Result<Boolean> updateMenu(@Validated @RequestBody SysMenu sysMenu) { sysMenuService.updateMenu(sysMenu); GeneralRequest request = new GeneralRequest(); return Result.build(200, "修改成功", sysMenuService.getMenuTree(request)); return Result.build(200, "修改成功", Boolean.TRUE); } @ApiOperation("获取用户有权限的所有菜单") hangzhoumesParent/common/springsecurity/src/main/java/com/mes/menu/service/SysMenuService.java
@@ -63,4 +63,5 @@ */ String batchDeleteMenu(List<Long> menuIds); Boolean saveMenu(SysMenu sysMenu); } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/menu/service/impl/SysMenuServiceImpl.java
@@ -15,7 +15,7 @@ import com.mes.role.service.SysRoleMenuService; import com.mes.userinfo.entity.SysUser; import com.mes.userinfo.entity.SysUserRole; import com.mes.userinfo.mapper.SysUserRoleMapper; import com.mes.userinfo.service.SysUserRoleService; import com.mes.userinfo.service.SysUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -41,7 +41,7 @@ SysUserService sysUserService; @Autowired SysUserRoleMapper sysUserRoleMapper; SysUserRoleService sysUserRoleService; @Autowired SysRoleMenuService sysRoleMenuService; @@ -64,12 +64,11 @@ .innerJoin(SysUser.class, SysUser::getId, SysUserRole::getUserId) .innerJoin(SysRoleMenu.class, SysRoleMenu::getRoleId, SysUserRole::getRoleId) .innerJoin(SysMenu.class, SysMenu::getId, SysRoleMenu::getMenuId) .eq(SysUser::getId, user.getId()) .like(StringUtils.isNotBlank(request.getKey()), SysMenu::getMenuName, request.getKey()) .eq(StringUtils.isNotBlank(request.getKey()), SysUser::getId, user.getId()) .orderByAsc(SysMenu::getListSort); // List<SysMenu> menuList = sysUserRoleMapper.selectJoinList(SysMenu.class, wrapper); List<SysMenu> menuList = sysUserRoleService.selectJoinList(SysMenu.class, wrapper); log.info("userinfos:{}", menuList); return create(menuList); } @@ -114,6 +113,15 @@ return "批量删除成功"; } @Override public Boolean saveMenu(SysMenu sysMenu) { this.save(sysMenu); SysUser user = UserInfoUtils.get(); SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getId())); sysRoleMenuService.save(new SysRoleMenu(one.getRoleId(), sysMenu.getId())); return Boolean.TRUE; } /** * 将数据库中查询出来的list集合传入此方法即可获得排成树形结构的list集合 @@ -127,7 +135,7 @@ .map(item -> { item.setChildren(getChildren(item, lists)); return item; }).collect(Collectors.toList()); }).sorted((o1, o2) -> o1.getListSort() - o2.getListSort()).collect(Collectors.toList()); return deptTreeList; } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/role/entity/SysRoleMenu.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; @@ -16,6 +17,7 @@ * @since 2024-04-11 */ @Data @AllArgsConstructor @EqualsAndHashCode(callSuper = false) public class SysRoleMenu implements Serializable { hangzhoumesParent/common/springsecurity/src/main/java/com/mes/role/service/impl/SysRoleServiceImpl.java
@@ -112,18 +112,14 @@ return "success"; } List<SysRoleMenu> roleMenuList = menuList.stream().map(menu -> { SysRoleMenu roleMenu = new SysRoleMenu(); roleMenu.setRoleId(roleId); roleMenu.setMenuId(menu.getId()); SysRoleMenu roleMenu = new SysRoleMenu(roleId,menu.getId()); return roleMenu; }).collect(Collectors.toList()); // 使用流处理菜单列表,提取 children 的 id,并设置到 SysRoleMenu 中 List<SysRoleMenu> childrenList = menuList.stream() .flatMap(menu -> menu.getChildren().stream()) // 扁平化处理 children 列表 .map(child -> { SysRoleMenu roleMenu = new SysRoleMenu(); roleMenu.setRoleId(roleId); roleMenu.setMenuId(child.getId()); // 设置 child 的 id 到 menuId SysRoleMenu roleMenu = new SysRoleMenu(roleId,child.getId()); return roleMenu; }) .collect(Collectors.toList()); hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/service/impl/SysUserServiceImpl.java
@@ -108,7 +108,7 @@ public String saveUser(SysUserVO user) { log.info("保存用户信息"); // 默认密码 String password = passwordEncoder.encode(Const.DEFULT_PASSWORD); String password = passwordEncoder.encode(user.getPassword()); user.setPassword(password); SysUser sysUser = new SysUser(); BeanUtils.copyProperties(user, sysUser); hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageServiceImpl.java
@@ -184,7 +184,7 @@ List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list(temperingGlassInfoWrapper); log.info("1、查询钢化小片任务表是否有待出玻璃" + temperingGlassInfoList.size()); if (temperingGlassInfoList.size() > 0) { temperingGlassInfoService.addOutTask(temperingGlassInfoList); // temperingGlassInfoService.addOutTask(temperingGlassInfoList); log.info("2、添加任务到任务表"); return true; } else { hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -393,17 +393,6 @@ log.info("当前未收到出片请求,结束出片任务"); return; } try { int outRequest = s7plcWZL.readUInt16("DB51.8"); if (outRequest == 0){ log.info("当前未收到卧转立允许出片请求,结束出片任务"); return; } } catch (Exception e) { log.error("读取卧转立信号异常", e); return; } //获取出片任务表 List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataWLTwo); if (CollectionUtil.isNotEmpty(outTaskList)) { @@ -480,6 +469,16 @@ Integer temperingOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_TEMPERING_OUT_TARGET_POSITION); if (redisUtil.getCacheObject("temperingSwitch")) { try { int outRequest = s7plcWZL.readUInt16("DB51.8"); if (outRequest == 0) { log.info("当前未收到卧转立允许出片请求,结束出片任务"); return; } } catch (Exception e) { log.error("读取卧转立信号异常", e); return; } //是否允许钢化 //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 // 获取当前钢化任务未完成出片的玻璃信息 @@ -1023,15 +1022,16 @@ computeOutGlassInfoByVirtualSlot(List<T> list, String tableName, int targetSlot, int state, int taskType) { //任务数据:获取车子存放玻璃最大数量,玻璃间隔 List<T> outGlassList = list; // if (!THROUGH_SLOT.equals(list.get(0).getSlot())) { // 临时解决方案:出片时考虑玻璃碰撞,改为一片一出 // 界面关闭调度开关 !Const.BIG_STORAGE_BEFORE_DISPATCH.equals(taskType) if (list.get(0).getSlot() >= 500 && list.get(0).getThickness() > 8) { outGlassList = list.subList(0, 1); } else { List<String> glassIdList = bigStorageGlassRelationInfoService.queryNeedOutGlassId( list.get(0).getEngineerId(), list.get(0).getTemperingLayoutId(), list.get(0).getTemperingFeedSequence()); outGlassList = list.stream().filter(e -> glassIdList.contains(e.getGlassId())).collect(Collectors.toList()); if (CollectionUtil.isEmpty(glassIdList)) { outGlassList = list.subList(0, 1); } else { outGlassList = list.stream().filter(e -> glassIdList.contains(e.getGlassId())).collect(Collectors.toList()); } } // } Assert.isFalse(CollectionUtil.isEmpty(outGlassList), "未获取出片数据,结束出片任务"); hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/temperingglass/service/TemperingGlassInfoService.java
File was deleted hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
File was deleted hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -563,23 +563,23 @@ private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) { Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$"); Pattern pattern = Pattern.compile("^(NG|R)(\\d+)([A-Za-z]+)(\\d+)$"); list.sort((v1, v2) -> { Matcher m1 = pattern.matcher(v1.getFlowCardId()); Matcher m2 = pattern.matcher(v2.getFlowCardId()); if (!m1.find() || !m2.find()) { throw new IllegalArgumentException("获取到的流程卡不符合校验规则"); log.info("获取到的流程卡不符合校验规则:流程卡A:{},流程卡B:{}", v1.getFlowCardId(), v2.getFlowCardId()); return -1; } // 提取部分 BigInteger order1 = new BigInteger(m1.group(1)); BigInteger order2 = new BigInteger(m2.group(1)); String layer1 = m1.group(2); String layer2 = m2.group(2); BigInteger seq1 = new BigInteger(m1.group(3)); BigInteger seq2 = new BigInteger(m2.group(3)); BigInteger order1 = new BigInteger(m1.group(2)); BigInteger order2 = new BigInteger(m2.group(2)); String layer1 = m1.group(3); String layer2 = m2.group(3); BigInteger seq1 = new BigInteger(m1.group(4)); BigInteger seq2 = new BigInteger(m2.group(4)); // 优先级排序 int cmp = order1.compareTo(order2); hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -262,23 +262,6 @@ } } // } //超大尺寸 // Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT); // Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS); // if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) { // int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>() // .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT) // .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); // if (count > 0) { // log.info("直通片台存在玻璃,结束本次进片"); // //向plc发送报警:直通片台存在玻璃,无法继续直通 // s7DataZKDLPOne = new S7DataZKDLPOne(); // s7DataZKDLPOne.setAlramSignal(64); // s7SerializerZKDLPOne.write(s7DataZKDLPOne); // return; // } // } log.info("将钢化小片表内的状态改为钢化结束,玻璃id有:{}", glassIdList); //修改钢化任务表中的状态 temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() @@ -286,7 +269,9 @@ //报工 log.info("将接收到的玻璃进行钢化自动报工,玻璃id有:{}", glassIdList); for (String glass : glassIdList) { damageService.autoSubmitReport(glass, inTaskList.get(0).getStartSlot(), "钢化", "进中空理片笼", 1); if (from.equals(910)) { damageService.autoSubmitReport(glass, inTaskList.get(0).getStartSlot(), "钢化", "进中空理片笼", 1); } } Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId)); @@ -509,20 +494,20 @@ break; } } for (Integer i : resultList) { if (null == hollowGlassOutRelationInfo) { cell = i; hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() .eq(HollowGlassOutRelationInfo::getCell, cell) .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) .orderByAsc(HollowGlassOutRelationInfo::getId) .last("limit 1") ); } else { break; } } // for (Integer i : resultList) { // if (null == hollowGlassOutRelationInfo) { // cell = i; // hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService // .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() // .eq(HollowGlassOutRelationInfo::getCell, cell) // .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) // .orderByAsc(HollowGlassOutRelationInfo::getId) // .last("limit 1") // ); // } else { // break; // } // } if (null != hollowGlassOutRelationInfo) { //是否允许中空 hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowFormulaDetailsMapper.xml
@@ -17,7 +17,8 @@ t3.formula_name, case when t3.film_remove = 0 then 0 else ifnull(t2.film_remove, 0) end as film_remove, when t2.filmsid = t.film_remove then 1 else 0 end as film_remove, t3.top_remove, t3.bottom_remove, t3.left_remove,