Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | public static final Integer GLASS_STATE_TAKE = 200; |
| | | public static final Integer GLASS_STATE_DAMAGE = 201; |
| | | public static final List<Integer> GLASS_STATE_IN_ALL = Arrays.asList(100, 102, 103, 104); |
| | | public static final List<Integer> GLASS_STATE_IN_ALL_ZERO = Arrays.asList(0, 100, 102, 103, 104); |
| | | |
| | | /** |
| | | * 卧式理片笼详情表玻璃状态 |
| | |
| | | */ |
| | | public static final List<Integer> G06_WORK_STATION = Arrays.asList(1, 2, 3); |
| | | public static final List<Integer> G11_WORK_STATION = Arrays.asList(4, 5, 6); |
| | | public static final List<Integer> G13_WORK_STATION = Arrays.asList(7); |
| | | public static final int G13_WORK_STATION = 7; |
| | | |
| | | /** |
| | | * 启用 1 |
| | |
| | | */ |
| | | @Override |
| | | public void submitDamage(List<Damage> damageList){ |
| | | Map<String, Map<String, Map<String, Map<String, List<Damage>>>>> resultMap = damageList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | Damage::getProcessId, |
| | | Collectors.groupingBy( |
| | | Damage::getWorkingProcedure, |
| | | Collectors.groupingBy( |
| | | Damage::getDeviceName, |
| | | Collectors.groupingBy(Damage::getTeamsGroupsName) |
| | | ) |
| | | ) |
| | | )); |
| | | // 遍历 resultMap |
| | | for (Map.Entry<String, Map<String, Map<String, Map<String, List<Damage>>>>> processEntry : resultMap.entrySet()) { |
| | | String processId = processEntry.getKey(); |
| | | System.out.println("ProcessId: " + processId); |
| | | Map<String, List<Damage>> firstMap = damageList.stream().collect(Collectors.groupingBy(e -> e.getProcessId() + ":" |
| | | + e.getWorkingProcedure() + ":" + e.getDeviceName() + ":" + e.getTeamsGroupsName())); |
| | | |
| | | // 获取第二层的 Map,按 workingProcedure 分组的结果 |
| | | Map<String, Map<String, Map<String, List<Damage>>>> workingProcedureMap = processEntry.getValue(); |
| | | for (Map.Entry<String, List<Damage>> entry : firstMap.entrySet()) { |
| | | String key = entry.getKey(); |
| | | List<Damage> damages = entry.getValue(); |
| | | |
| | | // 遍历 workingProcedureMap |
| | | for (Map.Entry<String, Map<String, Map<String, List<Damage>>>> workingProcedureEntry : workingProcedureMap.entrySet()) { |
| | | String workingProcedure = workingProcedureEntry.getKey(); |
| | | System.out.println(" WorkingProcedure: " + workingProcedure); |
| | | System.out.println("Key: " + key); |
| | | |
| | | // 获取第三层的 Map,按 deviceName 分组的结果 |
| | | Map<String, Map<String, List<Damage>>> deviceNameMap = workingProcedureEntry.getValue(); |
| | | Map<String, List<Damage>> secondMap = damageList.stream().collect(Collectors.groupingBy(e -> e.getProcessId() + ":" |
| | | + e.getWorkingProcedure() + ":" + e.getDeviceName() + ":" + e.getTeamsGroupsName())); |
| | | |
| | | // 遍历 deviceNameMap |
| | | for (Map.Entry<String, Map<String, List<Damage>>> deviceNameEntry : deviceNameMap.entrySet()) { |
| | | String deviceName = deviceNameEntry.getKey(); |
| | | System.out.println(" DeviceName: " + deviceName); |
| | | for (Map.Entry<String, List<Damage>> entrys : secondMap.entrySet()) { |
| | | |
| | | // 获取第四层的 Map,按 teamsGroupsName 分组的结果 |
| | | Map<String, List<Damage>> teamsGroupsNameMap = deviceNameEntry.getValue(); |
| | | |
| | | // 遍历 teamsGroupsNameMap |
| | | for (Map.Entry<String, List<Damage>> teamsGroupsNameEntry : teamsGroupsNameMap.entrySet()) { |
| | | String teamsGroupsName = teamsGroupsNameEntry.getKey(); |
| | | System.out.println(" TeamsGroupsName: " + teamsGroupsName); |
| | | |
| | | // 获取 Damage 列表 |
| | | List<Damage> damageListForTeamsGroupsName = teamsGroupsNameEntry.getValue(); |
| | | //报工主表数据 |
| | | ReportingWork reportingWork=new ReportingWork(); |
| | | reportingWork.setProcessId(processId); |
| | | reportingWork.setThisProcess(workingProcedure); |
| | | reportingWork.setDeviceName(deviceName); |
| | | reportingWork.setTeamsGroupsName(teamsGroupsName); |
| | | |
| | | Map<Integer, Map<Integer, Map<String, List<Damage>>>> groupedByOrderTechBreakage = damageListForTeamsGroupsName.stream() |
| | | .map(damage -> Optional.ofNullable(damage)) // 使用Optional处理可能为null的元素 |
| | | .filter(Optional::isPresent) // 过滤掉空的Optional |
| | | .map(Optional::get) // 获取非空的Damage对象 |
| | | .collect(Collectors.groupingBy( |
| | | damage -> Optional.ofNullable(damage.getOrderNumber()).orElse(0), // 使用orElse设置默认值,以处理null值 |
| | | Collectors.groupingBy( |
| | | damage -> Optional.ofNullable(damage.getTechnologyNumber()).orElse(0), // 同样处理technologyNumber可能为null的情况 |
| | | Collectors.groupingBy( |
| | | damage -> Optional.ofNullable(damage.getBreakageType()).orElse("Unknown"), // 处理breakageType可能为null的情况 |
| | | Collectors.toList() |
| | | ) |
| | | ) |
| | | )); |
| | | |
| | | // 遍历 groupedByOrderTechBreakage |
| | | for (Map.Entry<Integer, Map<Integer, Map<String, List<Damage>>>> orderEntry : groupedByOrderTechBreakage.entrySet()) { |
| | | Integer orderNumber = orderEntry.getKey(); |
| | | System.out.println(" OrderNumber: " + orderNumber); |
| | | |
| | | // 获取第二层的 Map,按 technologyNumber 分组的结果 |
| | | Map<Integer, Map<String, List<Damage>>> technologyNumberMap = orderEntry.getValue(); |
| | | |
| | | // 遍历 technologyNumberMap |
| | | for (Map.Entry<Integer, Map<String, List<Damage>>> technologyEntry : technologyNumberMap.entrySet()) { |
| | | Integer technologyNumber = technologyEntry.getKey(); |
| | | System.out.println(" TechnologyNumber: " + technologyNumber); |
| | | |
| | | // 获取第三层的 Map,按 breakageType 分组的结果 |
| | | Map<String, List<Damage>> breakageTypeMap = technologyEntry.getValue(); |
| | | |
| | | // 遍历 breakageTypeMap |
| | | for (Map.Entry<String, List<Damage>> breakageTypeEntry : breakageTypeMap.entrySet()) { |
| | | String breakageType = breakageTypeEntry.getKey(); |
| | | System.out.println(" BreakageType: " + breakageType); |
| | | |
| | | |
| | | // 获取 Damage 列表 |
| | | List<Damage> damageListForBreakageType = breakageTypeEntry.getValue(); |
| | | int completedQuantity=0; |
| | | int breakageQuantity=0; |
| | | // 遍历 Damage 列表 |
| | | for (Damage damage : damageListForBreakageType) { |
| | | // 打印或处理每个 Damage 对象 |
| | | System.out.println(" Damage: " + damage.toString()); |
| | | if(damage.getType()==1){ |
| | | completedQuantity+=1; |
| | | }else if(damage.getType()==2){ |
| | | breakageQuantity+=1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | if(workAssignment!=null){ |
| | | damage.setTeamsGroupsName(workAssignment.getTeamsGroupsName()); |
| | | damage.setDeviceName(workAssignment.getDeviceName()); |
| | | } |
| | | damage.setProcessId(glassInfo.getFlowCardId()); |
| | | damage.setOrderNumber(glassInfo.getGlassType()); |
| | | damage.setTechnologyNumber(glassInfo.getLayer()); |
| | | damage.setDamageTime(Timestamp.valueOf(LocalDateTime.now())); |
| | | damage.setType(2); |
| | | baseMapper.insert(damage); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import javax.print.attribute.standard.MediaSize; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectCurrentCutTerritory(String current) { |
| | | |
| | | return optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class) |
| | | //最终返回结果 |
| | | List<Map<String, Object>> ResultcutTerritorys=new ArrayList<>(); |
| | | //此工程的所有优化数据 |
| | | List<Map<String, Object>> cutTerritorys=optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class) |
| | | .selectAll(OptimizeDetail.class) |
| | | .selectAs(OptimizeLayout::getWidth, "olWidth") |
| | | .selectAs(OptimizeLayout::getWidth, "olHeight") |
| | |
| | | .eq(OptimizeLayout::getStockId, OptimizeDetail::getStockId)) |
| | | .eq(OptimizeDetail::getProjectNo, current) |
| | | ); |
| | | |
| | | Map<String, EdgStorageCageDetails> edgMaps=baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getEngineerId,current) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | ).stream().collect(Collectors.toMap(EdgStorageCageDetails::getGlassId,EdgStorageCageDetails->EdgStorageCageDetails)); |
| | | |
| | | for (Map<String, Object> cutTerritory : cutTerritorys) { |
| | | // log.info("内容:{}-------{}",cutTerritory,edgStorageCageDetails); |
| | | if(cutTerritory.get("glass_id")==null||"".equals(cutTerritory.get("glass_id"))){ |
| | | log.info("优化数据中glassId存在空值-----内容:{}",cutTerritorys); |
| | | return new ArrayList<>(); |
| | | }else if(edgMaps.get(cutTerritory.get("glass_id"))!=null){ |
| | | cutTerritory.put("glass_state",edgMaps.get(cutTerritory.get("glass_id")).getState()); |
| | | }else{ |
| | | cutTerritory.put("glass_state",0); |
| | | } |
| | | ResultcutTerritorys.add(cutTerritory); |
| | | } |
| | | return ResultcutTerritorys; |
| | | //Sql版本 |
| | | // return optimizeDetailMapper.selectJoinMaps(new MPJQueryWrapper<OptimizeDetail>().selectAll(OptimizeDetail.class) |
| | | // .select("ol.width as olwidth","ol.height as olheight") |
| | |
| | | @Value("${mes.min.two.secondLength}") |
| | | private String minTwoSecondLength; |
| | | |
| | | public static String engineerId=""; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | | Date startDate = new Date(); |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void CacheGlassTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //识别摆片 |
| | | List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); |
| | | // List<Map<String, Object>> currentCutTerritorys=new ArrayList<>(); |
| | | // if(engineerId==null||engineerId.isEmpty()){ |
| | | // //识别摆片 当前版图数据 |
| | | // currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); |
| | | // }else{ |
| | | // //识别摆片 此engineerId 工程版图数据 |
| | | // currentCutTerritorys = edgStorageCageDetailsService.selectCurrentCutTerritory(engineerId); |
| | | // } |
| | | jsonObject.append("currentCutTerritory", currentCutTerritorys); |
| | | //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys); |
| | | //磨边信息 |
| | | List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001"); |
| | | List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002"); |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.mes.job.CacheGlassTask.engineerId; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | |
| | | @PostMapping("/cutTerritory") |
| | | @ResponseBody |
| | | public Result cutTerritory(String current) { |
| | | //engineerId=current; |
| | | List<Map<String, Object>> h = edgStorageCageDetailsService.selectCurrentCutTerritory(current); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | |
| | | mes: |
| | | threshold: 3 |
| | | ratio: 10 |
| | | max: |
| | | max: # 第二条线的最大尺寸信息 |
| | | firstLength: 3500 |
| | | secondLength: 2500 |
| | | min: |
| | | one: #第一条磨边线的最小尺寸信息 |
| | | firstLength: 600 |
| | | secondLength: 350 |
| | | two: #第二条磨边线的最小尺寸信息 |
| | | firstLength: 400 |
| | | secondLength: 300 |
| | | sequence: |
| | | order: false |
| | | |
| | |
| | | } |
| | | |
| | | @Test |
| | | public void testEngineerCutTerritory() { |
| | | List<Map<String, Object>> map = edgStorageCageDetailsService.selectCurrentCutTerritory("P24051806"); |
| | | log.info("切割工程版图信息:{}", Arrays.asList(map)); |
| | | } |
| | | |
| | | @Test |
| | | public void testidentWorn() { |
| | | Map<String, String> arguments=new HashMap<>(); |
| | | arguments.put("glassId","P24060403|3|6");//玻璃ID |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface BigStorageCageMapper extends MPJBaseMapper<BigStorageCage> { |
| | | |
| | | List<Integer> queryFreeDeviceByUsed(@Param(value = "thickness") double thickness); |
| | | |
| | | List<Integer> queryFreeDeviceByNotUsed(@Param(value = "thickness") double thickness); |
| | | } |
| | |
| | | List<Map<String, Object>> selectBigStorageCageUsage(); |
| | | |
| | | void updateStorageCageDisabled(int slot, int enableState); |
| | | |
| | | List<Integer> queryFreeDeviceByUsed(double thickness); |
| | | |
| | | List<Integer> queryFreeDeviceByNotUsed(double thickness); |
| | | } |
| | |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class BigStorageCageDetailsServiceImpl extends MPJBaseServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService { |
| | | |
| | |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .eq(BigStorageCageDetails::getEngineerId,glassInfo.getEngineerId()) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight())) |
| | |
| | | } |
| | | BigStorageCage bigStorageCage = bigStorageCageService.selectJoinOne(BigStorageCage.class, wrapper); |
| | | if (null != bigStorageCage) { |
| | | log.info("无钢化版图id或根据当前玻璃片序+1找到目标格子:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | // .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = "+glassInfo.getEngineerId()+" and tempering_layout_id = " + glassInfo.getTemperingLayoutId()) |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + glassInfo.getEngineerId() + "' and tempering_layout_id = " + glassInfo.getTemperingLayoutId()) |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("根据版图id找到笼子内的目标格子:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | |
| | | return bigStorageDTO; |
| | | } |
| | | |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 因为子查询排序对主sql无影响,所以先执行子查询获取顺序,然后一次去查询 |
| | | List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(glassInfo.getThickness()); |
| | | for (Integer item : deviceUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | .notInSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where state in (100,102,103)") |
| | | .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .orderByAsc(BigStorageCage::getDeviceId) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("按照存笼玻璃格子数占用最少方式获取信息格子为:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | } |
| | | |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 |
| | | List<Integer> deviceNotUsedList = bigStorageCageService.queryFreeDeviceByNotUsed(glassInfo.getThickness()); |
| | | for (Integer item : deviceNotUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .orderByAsc(BigStorageCage::getDeviceId) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| | | Assert.isTrue(null != bigStorageCage, "没有空余的笼子存放玻璃"); |
| | | if (null != bigStorageCage) { |
| | | log.info("按照存笼玻璃格子数剩余最多得方式获取信息版图id:{},格子:{},玻璃id:{}", glassInfo.getTemperingLayoutId(), bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | } |
| | | Assert.isTrue(null != bigStorageCage, "没有空余的笼子存放玻璃"); |
| | | return bigStorageDTO; |
| | | } |
| | | |
| | |
| | | QueryWrapper<BigStorageCageDetails> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("engineer_id,tempering_layout_id,count(*) as count") |
| | | .in("state", Const.GLASS_STATE_IN, Const.GLASS_STATE_ARTIFICIAL) |
| | | .groupBy("engineer_id,tempering_layout_id"); |
| | | .groupBy("engineer_id,tempering_layout_id") |
| | | .orderByAsc("engineer_id") |
| | | .orderByAsc("tempering_layout_id"); |
| | | List<Map<String, Object>> TemperingGlass = baseMapper.selectMaps(wrapper); |
| | | return TemperingGlass; |
| | | } |
| | |
| | | bigStorageCageWrapper.eq(BigStorageCage::getSlot, slot); |
| | | baseMapper.update(bigStorageCage, bigStorageCageWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> queryFreeDeviceByUsed(double thickness) { |
| | | return baseMapper.queryFreeDeviceByUsed(thickness); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> queryFreeDeviceByNotUsed(double thickness) { |
| | | return baseMapper.queryFreeDeviceByNotUsed(thickness); |
| | | } |
| | | } |
| | |
| | | log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 10000) |
| | | public void plcToHomeEdgOutTask() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼空车进片任务开始执行时间:{}", startDate); |
| | |
| | | .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | computeOutMoreGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL).orderByDesc(BigStorageCageDetails::getWidth)); |
| | | if (CollectionUtils.isNotEmpty(artificialList)) { |
| | | computeOutGlassInfo(artificialList, Boolean.FALSE, mesToPLCAddress); |
| | | computeOutMoreGlassInfo(artificialList, Boolean.FALSE, mesToPLCAddress); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | | computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | computeOutMoreGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | Integer remainWidth = carWidth; |
| | | int maxX = 0; |
| | | for (T e : list) { |
| | | if (bigStorageCageOutTaskList.size() >= outCarMaxSize || e.getWidth() > remainWidth) { |
| | | if (bigStorageCageOutTaskList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) { |
| | | break; |
| | | } |
| | | remainWidth = remainWidth - (int) e.getWidth() - glassGap; |
| | | remainWidth = remainWidth - Math.max((int) e.getWidth(), (int) e.getHeight()) - glassGap; |
| | | if (isTempering) { |
| | | int minLength = Math.min((int) e.getWidth(), (int) e.getHeight()); |
| | | if (maxX + minLength <= xMaxSize) { |
| | |
| | | GROUP BY ENGINEER_ID, TEMPERING_LAYOUT_ID) T3 ON T2.ENGINEER_ID = T3.ENGINEER_ID |
| | | AND T2.TEMPERING_LAYOUT_ID = T3.TEMPERING_LAYOUT_ID |
| | | AND T2.COUNT = T3.COUNT |
| | | ORDER BY T2.ENGINEER_ID, T2.TEMPERING_LAYOUT_ID |
| | | </select> |
| | | |
| | | <select id="queryTemperingOccupySlot" resultMap="temperingLayoutDTO"> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.bigstorage.mapper.BigStorageCageMapper"> |
| | | |
| | | |
| | | <select id="queryFreeDeviceByUsed" resultType="java.lang.Integer"> |
| | | SELECT T.DEVICE_ID |
| | | FROM BIG_STORAGE_CAGE T |
| | | LEFT JOIN (SELECT * FROM BIG_STORAGE_CAGE_DETAILS WHERE STATE NOT IN (101, 200, 201)) T1 |
| | | ON T.SLOT = T1.SLOT |
| | | WHERE T.MAX_THICKNESS >= #{thickness} |
| | | AND T.ENABLE_STATE = 1 |
| | | GROUP BY T.DEVICE_ID |
| | | ORDER BY COUNT(DISTINCT T1.TEMPERING_LAYOUT_ID), |
| | | COUNT(DISTINCT T1.SLOT) |
| | | </select> |
| | | |
| | | <select id="queryFreeDeviceByNotUsed" resultType="java.lang.Integer"> |
| | | SELECT T.DEVICE_ID |
| | | FROM BIG_STORAGE_CAGE T |
| | | LEFT JOIN (SELECT * FROM BIG_STORAGE_CAGE_DETAILS WHERE STATE NOT IN (101, 200, 201)) T1 |
| | | ON T.SLOT = T1.SLOT |
| | | WHERE T.MAX_THICKNESS >= #{thickness} |
| | | AND T.ENABLE_STATE = 1 |
| | | GROUP BY T.DEVICE_ID |
| | | ORDER BY COUNT(DISTINCT T1.TEMPERING_LAYOUT_ID), |
| | | COUNT(DISTINCT T.SLOT) - COUNT(DISTINCT T1.SLOT) DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | jsonObject.append("list", upWorkstations); |
| | | //是否开始工程 |
| | | Engineering engineering = engineeringService.selectInitiate(1); |
| | | if (engineering != null){ |
| | | jsonObject.append("engineering", engineering); |
| | | }else { |
| | | jsonObject.append("engineering", "0"); |
| | | } |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 工位id |
| | | */ |
| | | private Integer workStationId; |
| | | |
| | | /** |
| | | * 工程id |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | |
| | | //生成任务信息 并向plc发送出片任务 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | | BeanUtils.copyProperties(details, glassInfo); |
| | | return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), 3001, 2); |
| | | return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), Const.G13_WORK_STATION, 2); |
| | | } |
| | | } |
| | |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | |
| | | endCell = workstation.getWorkstationId(); |
| | | } |
| | | //更新落架玻璃数量 |
| | | if (endCell == 7) { |
| | | if (endCell == Const.G13_WORK_STATION) { |
| | | downWorkstationService.update(new UpdateWrapper<DownWorkstation>().eq("flow_card_id", downStorageCageDetails.getFlowCardId()) |
| | | .eq("layer", downStorageCageDetails.getLayer()).setSql("other_number = other_number +1")); |
| | | } else { |
| | |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfo.setWorkStationId(endCell); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | |
| | | package com.mes.job;
|
| | |
|
| | | import cn.hutool.json.JSONObject;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.mes.downglassinfo.entity.DownGlassInfo;
|
| | | import com.mes.downglassinfo.service.DownGlassInfoService;
|
| | | import com.mes.downstorage.service.DownStorageCageService;
|
| | | import com.mes.downworkstation.entity.DownWorkstation;
|
| | | import com.mes.downworkstation.service.DownWorkstationService;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | @Slf4j
|
| | | @Component
|
| | |
| | | private DownWorkstationService downWorkstationService;
|
| | | @Autowired
|
| | | private DownStorageCageService downStorageCageService;
|
| | | @Autowired
|
| | | private DownGlassInfoService downGlassInfoService;
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownWorkstations() {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownGlassInfo() {
|
| | | log.info("发送当前正在执行工程已落架的玻璃信息");
|
| | | List<DownGlassInfo> downGlassInfos = downGlassInfoService.list(new LambdaQueryWrapper<DownGlassInfo>()
|
| | | .inSql(DownGlassInfo::getEngineerId, "select engineer_id from engineering where state = 1"));
|
| | | Map<Integer, List<DownGlassInfo>> listMap = downGlassInfos.stream().collect(Collectors.groupingBy(DownGlassInfo::getWorkStationId));
|
| | | JSONObject jsonObject4 = new JSONObject();
|
| | | List<Map<String, Object>> list = downStorageCageService.selectDownStorageCages();
|
| | | jsonObject4.append("params", listMap);
|
| | | ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("sendDownGlass");
|
| | | if (sendwServer4 != null) {
|
| | | for (WebSocketServer webserver : sendwServer4) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject4.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | order by count desc limit 1 |
| | | </select> |
| | | <select id="queryMaxSequence" resultType="java.lang.Integer"> |
| | | SELECT COALESCE(max(sequence) + 1, 0) as sequence |
| | | SELECT COALESCE(max(sequence) + 1, 1) as sequence |
| | | FROM down_glass_info |
| | | WHERE flow_card_id = #{flowCardId} |
| | | AND layer = #{layer} |