Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | import Swal from 'sweetalert2' |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket } from '@/utils/WebSocketService'; |
| | | import { initializeWebSocket,closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost } from '@/utils/constants'; |
| | | const racks = ref([ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456',downGlassInfoList:"" } }, |
| | |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | import Swal from 'sweetalert2' |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket } from '@/utils/WebSocketService'; |
| | | import { initializeWebSocket,closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | const racks = ref([ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } }, |
| | |
| | | |
| | | @ApiOperation("报工") |
| | | @PostMapping("/submitDamage") |
| | | public Result submitDamage(@RequestBody Map map) { |
| | | String startTime=map.get("startTime").toString(); |
| | | String endTime=map.get("endTime").toString(); |
| | | int type =Integer.parseInt(map.get("type").toString()); |
| | | int status =Integer.parseInt(map.get("status").toString()); |
| | | String workingProcedure =map.get("workingProcedure").toString(); |
| | | damageService.submitDamage(startTime,endTime,type,status,workingProcedure); |
| | | public Result submitDamage(@RequestBody List<Damage> damageList) { |
| | | damageService.submitDamage(damageList); |
| | | damageService.updateBatchById(damageList); |
| | | return Result.build(200,"报工成功",1); |
| | | } |
| | | |
| | |
| | | |
| | | List<Damage> selectDamage(String startTime, String endTime, int type, int status, String workingProcedure); |
| | | |
| | | void submitDamage(String startTime, String endTime, int type, int status, String workingProcedure); |
| | | void submitDamage(List<Damage> damageList); |
| | | |
| | | void insertDamage(Damage damage); |
| | | } |
| | |
| | | package com.mes.damage.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.mapper.DamageMapper; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.pp.entity.BasicDataProduce; |
| | | import com.mes.pp.entity.ReportingWork; |
| | | import com.mes.work_assignment.entity.WorkAssignment; |
| | | import com.mes.work_assignment.mapper.WorkAssignmentMapper; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | if(!"0".equals(workingProcedure)){ |
| | | damageSelectWrapper.eq(Damage::getWorkingProcedure,workingProcedure); |
| | | } |
| | | List<Damage> damageList = baseMapper.selectList(damageSelectWrapper); |
| | | |
| | | for (Damage damage : damageList) { |
| | | damage.setStatus(2); |
| | | } |
| | | return baseMapper.selectList(damageSelectWrapper); |
| | | } |
| | | |
| | |
| | | * 提交报工 |
| | | */ |
| | | @Override |
| | | public void submitDamage(String startTime, String endTime, int type, int status, String workingProcedures){ |
| | | LambdaUpdateWrapper<Damage> damageUpdateWrapper=new LambdaUpdateWrapper<>(); |
| | | LambdaQueryWrapper<Damage> damageLambdaQueryWrapper=new LambdaQueryWrapper<>() |
| | | ; damageUpdateWrapper.between(Damage::getDamageTime,startTime,endTime); |
| | | damageLambdaQueryWrapper.between(Damage::getDamageTime,startTime,endTime); |
| | | if (type!=0){ |
| | | damageUpdateWrapper.eq(Damage::getType,type); |
| | | damageLambdaQueryWrapper.eq(Damage::getType,type); |
| | | } |
| | | if (status!=0){ |
| | | damageUpdateWrapper.eq(Damage::getStatus,status); |
| | | damageLambdaQueryWrapper.eq(Damage::getStatus,status); |
| | | } |
| | | if(!"0".equals(workingProcedures)){ |
| | | damageUpdateWrapper.eq(Damage::getWorkingProcedure,workingProcedures); |
| | | damageLambdaQueryWrapper.eq(Damage::getWorkingProcedure,workingProcedures); |
| | | } |
| | | // Damage damage=new Damage(); |
| | | // damage.setStatus(2); |
| | | // baseMapper.update(damage,damageUpdateWrapper); |
| | | List<Damage> damageList = baseMapper.selectList(damageLambdaQueryWrapper); |
| | | public void submitDamage(List<Damage> damageList){ |
| | | Map<String, Map<String, Map<String, Map<String, List<Damage>>>>> resultMap = damageList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | Damage::getProcessId, |
| | |
| | | |
| | | // 获取 Damage 列表 |
| | | List<Damage> damageListForTeamsGroupsName = teamsGroupsNameEntry.getValue(); |
| | | //报工主表数据 |
| | | ReportingWork reportingWork=new ReportingWork(); |
| | | reportingWork.setProcessId(processId); |
| | | reportingWork.setThisProcess(workingProcedure); |
| | | reportingWork.setDeviceName(deviceName); |
| | | reportingWork.setTeamsGroupsName(teamsGroupsName); |
| | | |
| | | // 使用 stream 对 damageListForTeamsGroupsName 进行再次分组 |
| | | 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::getOrderNumber, |
| | | damage -> Optional.ofNullable(damage.getOrderNumber()).orElse(0), // 使用orElse设置默认值,以处理null值 |
| | | Collectors.groupingBy( |
| | | Damage::getTechnologyNumber, |
| | | damage -> Optional.ofNullable(damage.getTechnologyNumber()).orElse(0), // 同样处理technologyNumber可能为null的情况 |
| | | Collectors.groupingBy( |
| | | Damage::getBreakageType, |
| | | damage -> Optional.ofNullable(damage.getBreakageType()).orElse("Unknown"), // 处理breakageType可能为null的情况 |
| | | Collectors.toList() |
| | | ) |
| | | ) |
| | |
| | | String breakageType = breakageTypeEntry.getKey(); |
| | | System.out.println(" BreakageType: " + breakageType); |
| | | |
| | | ReportingWork reportingWork=new ReportingWork(); |
| | | reportingWork.setProcessId(processId); |
| | | reportingWork.setThisProcess(workingProcedure); |
| | | reportingWork.setDeviceName(deviceName); |
| | | reportingWork.setTeamsGroupsName(teamsGroupsName); |
| | | |
| | | // 获取 Damage 列表 |
| | | List<Damage> damageListForBreakageType = breakageTypeEntry.getValue(); |
| | | int completedQuantity=0; |
| | |
| | | .eq(WorkAssignment::getLine,damage.getLine()) |
| | | .eq(WorkAssignment::getWorkProcesses,damage.getWorkingProcedure()); |
| | | WorkAssignment workAssignment=workAssignmentMapper.selectOne(workAssignmentSelectWrapper); |
| | | |
| | | 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); |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private WorkAssignmentService workAssignmentService; |
| | | @ApiOperation("值班数据查询") |
| | | @PostMapping("/selectWorkAssignment") |
| | | public Result selectWorkAssignment(int line,String workingProcedure) { |
| | | public Result selectWorkAssignment(@RequestBody Map map) { |
| | | String line=map.get("line").toString(); |
| | | String workingProcedure=map.get("workingProcedure").toString(); |
| | | return Result.build(200,"查询成功",workAssignmentService.selectWorkAssignment(line,workingProcedure)); |
| | | } |
| | | |
| | |
| | | import com.mes.work_assignment.entity.WorkAssignment; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | */ |
| | | public interface WorkAssignmentService extends IService<WorkAssignment> { |
| | | |
| | | WorkAssignment selectWorkAssignment(int line, String workingProcedure); |
| | | List<WorkAssignment> selectWorkAssignment(String line, String workingProcedure); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WorkAssignment selectWorkAssignment(int line, String workingProcedure){ |
| | | public List<WorkAssignment> selectWorkAssignment(String line, String workingProcedure){ |
| | | LambdaQueryWrapper<WorkAssignment> workAssignmentSelectWrapper=new LambdaQueryWrapper<>(); |
| | | workAssignmentSelectWrapper |
| | | .eq(WorkAssignment::getLine,line) |
| | | .eq(WorkAssignment::getWorkProcesses,workingProcedure); |
| | | return baseMapper.selectOne(workAssignmentSelectWrapper); |
| | | return baseMapper.selectList(workAssignmentSelectWrapper); |
| | | } |
| | | } |
| | |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | @Value("${mes.max.secondLength}") |
| | | private String secondLength; |
| | | |
| | | @Value("${mes.min.firstLength}") |
| | | private String minFirstLength; |
| | | @Value("${mes.min.one.firstLength}") |
| | | private String minOneFirstLength; |
| | | |
| | | @Value("${mes.min.secondLength}") |
| | | private String minSecondLength; |
| | | @Value("${mes.min.one.secondLength}") |
| | | private String minOneSecondLength; |
| | | |
| | | @Value("${mes.min.two.firstLength}") |
| | | private String minTwoFirstLength; |
| | | |
| | | @Value("${mes.min.two.secondLength}") |
| | | private String minTwoSecondLength; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } else if ("2".equals(taskRequestTypeValue)) { |
| | | //09空闲 :1 10空闲 :2 都空闲:3 其他0 |
| | | log.info("2、出片请求,且确认字为0,执行进片任务"); |
| | | log.info("2、出片请求,且确认字为0,执行出片任务"); |
| | | outTo(Integer.parseInt(out08Glassstate), |
| | | Integer.parseInt(out10Glassstate), confirmationWrodAddress, "", 0); |
| | | } else if ("3".equals(taskRequestTypeValue)) { |
| | |
| | | Date endDate = new Date(); |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingIsRun(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<TaskCache>taskCaches=taskCacheService.selectTaskCacheIsRun(); |
| | | jsonObject.append("taskCaches", taskCaches); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 进片任务 |
| | | * |
| | |
| | | // 2、如果没有历史出片任务 |
| | | // 2.1、出当前版图id最小版序最小的玻璃(问题:两条线都没有历史任务,出片时两条线的玻璃尺寸相同,是否找尺寸不同的) |
| | | if ((out08Glassstate == 2 && out10Glassstate == 2) || (out08Glassstate == 0 && out10Glassstate == 0)) { |
| | | log.info("A09、A10为{},{}非自动状态,无法出片"); |
| | | log.info("A09、A10为{},{}非自动状态,无法出片", out08Glassstate, out10Glassstate); |
| | | return Boolean.FALSE; |
| | | } |
| | | log.info("0、出片任务出的状态:A09:【{}】;A10:【{}】)", out08Glassstate, out10Glassstate); |
| | |
| | | if (endcell == Const.A10_OUT_TARGET_POSITION) { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | } else { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minOneFirstLength + " and t1.second_length>=" + minOneSecondLength + ") "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | MPJQueryWrapper<GlassInfo> queryWrapper = new MPJQueryWrapper<GlassInfo>() |
| | | .selectAll(GlassInfo.class).eq("t.glass_id", glassId); |
| | | // .inSql("t.engineer_id", "select engineer_id from engineering where state = 1"); |
| | | if (endcell == Const.A10_OUT_TARGET_POSITION) { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | } else { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minOneFirstLength + " and t1.second_length>=" + minOneSecondLength + ") "); |
| | | } |
| | | GlassInfo one = glassInfoService.getOne(queryWrapper); |
| | | if (one != null) { |
| | |
| | | if (endcell == Const.A10_OUT_TARGET_POSITION) { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | } else { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minOneFirstLength + " and t1.second_length>=" + minOneSecondLength + ") "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | |
| | | return queryMinGlass(firstSize.getWidth(), firstSize.getHeight(), glassId); |
| | | } |
| | | EdgStorageCageDetails outGlassInfo = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId())); |
| | | .eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId()).last("limit 1")); |
| | | log.info("{}线有出片任务信息,任务信息为{},玻璃信息为{}", endcell, taskCache, outGlassInfo); |
| | | if (outGlassInfo.getWidth() == firstWidth && outGlassInfo.getHeight() == firstHeight) { |
| | | log.info("数量最多的宽{}高{}和{}线任务的宽{}高{}相同,出数量排第二的玻璃,宽{}高{}", |
| | |
| | | edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE); |
| | | edgGlassTaskInfo.setLine(endcell); |
| | | edgGlassTaskInfo.setTime(new Date()); |
| | | //先将历史对列表中本玻璃的数据删除,重新新增一份最新的数据 |
| | | edgGlassTaskInfoService.remove(new LambdaQueryWrapper<EdgGlassTaskInfo>().eq(EdgGlassTaskInfo::getGlassId, glassInfo.getGlassId())); |
| | | return edgGlassTaskInfoService.save(edgGlassTaskInfo); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @since 2024-04-07 |
| | | */ |
| | | @DS("salve_hangzhoumes") |
| | | public interface TaskCacheMapper extends BaseMapper<TaskCache> { |
| | | public interface TaskCacheMapper extends MPJBaseMapper<TaskCache> { |
| | | |
| | | TaskCache queryGlassByTaskCache(@Param(value = "line") int line, @Param(value = "taskTypes") List<Integer> taskTypes); |
| | | } |
| | |
| | | package com.mes.taskcache.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | import java.util.List; |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TaskCacheService extends IService<TaskCache> { |
| | | public interface TaskCacheService extends MPJBaseService<TaskCache> { |
| | | |
| | | |
| | | boolean insertTaskCache(TaskCache taskCache); |
| | |
| | | * @return |
| | | */ |
| | | TaskCache selectLastOutCacheInfo(int line); |
| | | /** |
| | | * 查询判断磨边线是否有玻璃运行 |
| | | * @param |
| | | * @return |
| | | */ |
| | | List<TaskCache> selectTaskCacheIsRun(); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | public class TaskCacheServiceImpl extends MPJBaseServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | |
| | | @Autowired |
| | | EdgStorageCageDetailsMapper edgStorageCageDetailsMapper; |
| | | |
| | | @Autowired |
| | | GlassInfoMapper glassInfoMapper; |
| | | @Autowired |
| | | private TaskCacheMapper taskCacheMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | public TaskCache selectLastOutCacheInfo(int line){ |
| | | return baseMapper.selectOne(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell,line).eq(TaskCache::getTaskStatus,1).orderByDesc(TaskCache::getCreateTime)); |
| | | } |
| | | |
| | | /** |
| | | * 查询判断磨边线是否有玻璃运行 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectTaskCacheIsRun() { |
| | | List<TaskCache> taskCaches=null; |
| | | taskCaches=taskCacheMapper.selectJoinList(TaskCache.class, new MPJLambdaWrapper<TaskCache>() |
| | | .select("top 4 t.end_cell,ISNULL(b.glass_id, 0)as glass_id") |
| | | .leftJoin("big_storage_cage_feed_task as b on t.glass_id=b.glass_id ") |
| | | .groupBy("t.end_cell,b.glass_id,t.create_time") |
| | | .orderByDesc("t.create_time") |
| | | ); |
| | | return taskCaches; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCageDetails::getEngineerId,glassInfo.getEngineerId()) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight())) |
| | | .last("limit 1"); |
| | |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .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 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) { |
| | | bigStorageDTO = new BigStorageDTO(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingIsRun(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //进片任务数据 |
| | | List<BigStorageCageDetails> bigStorageCageDetailsFeedTask=bigStorageCageDetailsService.selectFeedTask(); |
| | | jsonObject.append("bigStorageCageDetailsFeedTask", bigStorageCageDetailsFeedTask); |
| | | //出片任务数据 |
| | | List<BigStorageCageDetails> bigStorageCageDetailsOutTask=bigStorageCageDetailsService.selectOutTask(); |
| | | jsonObject.append("bigStorageCageDetailsOutTask", bigStorageCageDetailsOutTask); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 2000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcToHomeEdgOutTask() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼空车进片任务开始执行时间:{}", startDate); |
| | |
| | | bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW).in(BigStorageCageDetails::getGlassId, inDamageTaskInfoList.stream().map(BigStorageCageFeedTask::getGlassId).collect(Collectors.toList()))); |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageFeedTask bigStorageCageFeedTask : inDamageTaskInfoList) { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(bigStorageCageFeedTask.getGlassId()); |
| | |
| | | damage.setRemark("进笼前卧转立"); |
| | | damage.setStatus(2); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(bigStorageCageFeedTask.getTargetSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("进片任务执行完成"); |
| | | } |
| | | //获取出片任务表中状态为破损的数据 |
| | |
| | | .eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_DAMAGE)); |
| | | if (CollectionUtils.isNotEmpty(outDamageTaskInfoList)) { |
| | | log.info("获取出片任务表中破损的玻璃信息{}", outDamageTaskInfoList); |
| | | bigStorageCageOutTaskService.remove(new LambdaQueryWrapper<BigStorageCageOutTask>().eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_IN_DAMAGE)); |
| | | bigStorageCageOutTaskService.remove(new LambdaQueryWrapper<BigStorageCageOutTask>().eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_DAMAGE)); |
| | | List<String> glassIdList = outDamageTaskInfoList.stream().map(BigStorageCageOutTask::getGlassId).collect(Collectors.toList()); |
| | | //移除钢化下片表数据 |
| | | temperingGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().in(TemperingGlassInfo::getGlassId, glassIdList)); |
| | |
| | | bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>().in(BigStorageCageDetails::getGlassId, glassIdList)); |
| | | |
| | | //将破损信息新增入破损表 |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | for (BigStorageCageOutTask bigStorageCageOutTask : outDamageTaskInfoList) { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(bigStorageCageOutTask.getGlassId()); |
| | |
| | | damage.setRemark("出片后卧转立"); |
| | | damage.setStatus(2); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(bigStorageCageOutTask.getStartSlot()); |
| | | } |
| | | //更新格子剩余宽度 |
| | | updateSlotRemainBySlots(slotList); |
| | | log.info("出片任务执行完成"); |
| | | } |
| | | Date endDate = new Date(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 出片一次仅生成一车玻璃 |
| | | * |
| | | * @param list |
| | | * @param isTempering |
| | | * @param mesToPLCAddress |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, Boolean isTempering, String mesToPLCAddress) { |
| | | //任务数据 获取车子存放玻璃最大数量 玻璃间隔 |
| | | List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>(); |
| | | //打车剩余尺寸 |
| | | Integer remainWidth = carWidth; |
| | | int maxX = 0; |
| | | for (T e : list) { |
| | | if (bigStorageCageOutTaskList.size() >= outCarMaxSize || e.getWidth() > remainWidth) { |
| | | break; |
| | | } |
| | | remainWidth = remainWidth - (int) e.getWidth() - glassGap; |
| | | if (isTempering) { |
| | | int minLength = Math.min((int) e.getWidth(), (int) e.getHeight()); |
| | | if (maxX + minLength <= xMaxSize) { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1)); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight(), 0, 0, 1)); |
| | | } |
| | | } |
| | | Assert.isFalse(CollectionUtils.isEmpty(bigStorageCageOutTaskList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", bigStorageCageOutTaskList.size()); |
| | | bigStorageCageOutTaskService.saveBatch(bigStorageCageOutTaskList); |
| | | List<String> glassIds = bigStorageCageOutTaskList.stream().map(BigStorageCageOutTask::getGlassId).collect(Collectors.toList()); |
| | | log.info("将出片玻璃{}玻璃状态改为已出片", glassIds); |
| | | bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT_ING) |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | int returnData = 0; |
| | | int count = 1; |
| | | while (returnData == 0) { |
| | | S7object.getinstance().plccontrol.writeWord(mesToPLCAddress, 1); |
| | | returnData = S7object.getinstance().plccontrol.readWord(mesToPLCAddress, 1).get(0); |
| | | log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, mesToPLCAddress, returnData); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | /** |
| | | * 出片一次生成一炉玻璃 |
| | | * |
| | | * @param list |
| | | * @param isTempering |
| | | * @param mesToPLCAddress |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | private <T extends BigStorageCageBaseInfo> Boolean computeOutMoreGlassInfo(List<T> list, Boolean isTempering, String mesToPLCAddress) { |
| | | //任务数据 获取车子存放玻璃最大数量 玻璃间隔 |
| | | List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>(); |
| | | //打车剩余尺寸 |
| | |
| | | int maxX = 0; |
| | | for (T e : list) { |
| | | int maxLength = Math.max((int) e.getWidth(), (int) e.getHeight()); |
| | | if (bigStorageCageOutTaskList.size() >= outCarMaxSize || maxLength > remainWidth) { |
| | | if (serialNumber > outCarMaxSize || maxLength > remainWidth) { |
| | | remainWidth = carWidth; |
| | | trainNumber = trainNumber + 1; |
| | | serialNumber = 1; |
| | | maxX = 0; |
| | | continue; |
| | | } |
| | | remainWidth = remainWidth - maxLength - glassGap; |
| | | if (isTempering) { |
| | |
| | | e.getWidth() * 10, e.getHeight() * 10, trainNumber, serialNumber++, 1)); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | remainWidth = carWidth; |
| | | remainWidth = carWidth - maxLength - glassGap; |
| | | trainNumber = trainNumber + 1; |
| | | serialNumber = 1; |
| | | maxX = 0; |
| | | continue; |
| | | maxX = e.getXCoordinate(); |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight(), trainNumber, serialNumber++, 1)); |
| | | } |
| | | } else { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION, |
| | |
| | | //查询是否有开始上片的工程任务 |
| | | QueryWrapper<Engineering> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state", state); |
| | | return this.getOne(wrapper); |
| | | return engineeringMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | //工位信息 |
| | | List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | 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) { |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | String inkageStatus =plcParameterObject.getPlcParameter("InkageStatus").getValue(); |
| | | // String inkageStatus ="1"; |
| | | //String inkageStatus ="1"; |
| | | jsonObject.append("InkageStatus", inkageStatus); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void loadGlassIsRun() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | Engineering engineering = engineeringService.selectInitiate(1); |
| | | if (engineering != null){ |
| | | jsonObject.append("engineering", engineering); |
| | | }else { |
| | | jsonObject.append("engineering", "0"); |
| | | } |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("IsRun"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | |
| | |
| | | log.info("2、查询卧式理片笼里面的空格:{}", nearestEmpty); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | Assert.isFalse(null == glassInfo, "玻璃信息不存在"); |
| | | if ("1".equals(requestWord) && (glassInfo.getWidth() > throughWidth || glassInfo.getHeight() > throughHeight)) { |
| | | log.info("玻璃当前尺寸宽:{},高:{}只能直通,当前进片任务需等待", glassInfo.getWidth(), glassInfo.getHeight()); |
| | | double glassWidth = Math.max(glassInfo.getWidth(), glassInfo.getHeight()); |
| | | double glassHeight = Math.min(glassInfo.getWidth(), glassInfo.getHeight()); |
| | | if ("1".equals(requestWord) && (glassWidth > throughWidth || glassHeight > throughHeight)) { |
| | | log.info("玻璃当前尺寸宽:{},高:{}只能直通,当前进片任务需等待", glassWidth, glassHeight); |
| | | return; |
| | | } |
| | | Boolean checkFlag = Boolean.FALSE; |
| | | //玻璃尺寸是否走人工下片 |
| | | if (glassInfo.getWidth() > maxWidth || glassInfo.getHeight() > maxHeight || glassInfo.getWidth() < minWidth || glassInfo.getHeight() < minHeight) { |
| | | if (glassWidth > maxWidth || glassHeight > maxHeight || glassWidth < minWidth || glassHeight < minHeight) { |
| | | log.info("该玻璃尺寸不符合要求,需要走人工下片直接进片"); |
| | | } else { |
| | | log.info("该玻璃尺寸非人工下片"); |
| | |
| | | DownWorkstation one = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getLayer, glassInfo.getLayer()) |
| | | .eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); |
| | | //是否已经绑定 true:已绑定 false:未绑定 |
| | | Boolean isBind = Boolean.FALSE; |
| | | if (null != one) { |
| | | log.info("该流程卡已绑定架子"); |
| | |
| | | if (!checkFlag && !isBind) { |
| | | log.info("该玻璃的流程卡未绑定架子,获取是否有空架子"); |
| | | List<DownWorkstation> list = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNull(DownWorkstation::getFlowCardId).orderByDesc(DownWorkstation::getWorkstationId)); |
| | | .and(on -> on.isNull(DownWorkstation::getFlowCardId).or().eq(DownWorkstation::getFlowCardId, "")).orderByDesc(DownWorkstation::getWorkstationId)); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | log.info("有空架子,将流程卡与架子好绑定,执行进片任务 结束"); |
| | | //绑定流程卡 |
| | |
| | | endLoop: |
| | | for (DownGlassInfoDTO e : downGlassInfoDTOList) { |
| | | List<GlassInfo> glassInfoList = e.getGlassInfoList(); |
| | | Optional<GlassInfo> glassInfoTempOptional = glassInfoList.stream().filter(item -> item.getWidth() == glassInfo.getWidth() && item.getHeight() == glassInfo.getHeight() |
| | | && item.getThickness() == glassInfo.getThickness() && item.getFilmsid().equals(glassInfo.getFilmsid())) |
| | | .findFirst(); |
| | | if (glassInfoTempOptional.isPresent()) { |
| | | GlassInfo item = glassInfoTempOptional.get(); |
| | | //玻璃是否为多层 |
| | | checkFlag = multilayerCheck(item, Boolean.FALSE); |
| | | if (checkFlag) { |
| | | //玻璃替换 仅替换流程卡id及层数 |
| | | String tempFlowCardId = item.getFlowCardId(); |
| | | Integer tempLayer = item.getLayer(); |
| | | String flowCardId = glassInfo.getFlowCardId(); |
| | | Integer layer = glassInfo.getLayer(); |
| | | log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", |
| | | item, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); |
| | | glassInfo.setFlowCardId(tempFlowCardId); |
| | | glassInfo.setLayer(tempLayer); |
| | | glassInfoService.updateById(glassInfo); |
| | | item.setFlowCardId(flowCardId); |
| | | item.setLayer(layer); |
| | | glassInfoService.updateById(item); |
| | | break endLoop; |
| | | List<GlassInfo> glassInfoTempList = glassInfoList.stream().filter(item -> item.getWidth() == glassInfo.getWidth() && item.getHeight() == glassInfo.getHeight() |
| | | && item.getThickness() == glassInfo.getThickness() && item.getFilmsid().equals(glassInfo.getFilmsid())).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(glassInfoTempList)) { |
| | | for (GlassInfo item : glassInfoTempList) { |
| | | //玻璃是否为多层:1、先获取当前流程卡落架最多的层数,如果为空,表明未绑定流程卡,未落架,然后按照是否可绑定架子决定是否替换。(可忽略不计,本校验仅在前一次调用起作用) |
| | | // 2、判断落架最多的层数是否为当前替换玻璃的层数,是 则走替换逻辑返回true |
| | | // 3、不是最多的层数,获取落架最多层数的相同次序的玻璃尺寸与当前替换玻璃的尺寸比较,相同走替换,否则继续循环 |
| | | // 4、单层玻璃直接走替换 |
| | | checkFlag = multilayerCheck(item, Boolean.FALSE); |
| | | if (checkFlag) { |
| | | //玻璃替换 仅替换流程卡id及层数 |
| | | String tempFlowCardId = item.getFlowCardId(); |
| | | Integer tempLayer = item.getLayer(); |
| | | String flowCardId = glassInfo.getFlowCardId(); |
| | | Integer layer = glassInfo.getLayer(); |
| | | log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", |
| | | item, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); |
| | | glassInfo.setFlowCardId(tempFlowCardId); |
| | | glassInfo.setLayer(tempLayer); |
| | | glassInfoService.updateById(glassInfo); |
| | | item.setFlowCardId(flowCardId); |
| | | item.setLayer(layer); |
| | | glassInfoService.updateById(item); |
| | | break endLoop; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_IN); |
| | | downStorageCageDetails.setSlot(nearestEmpty.getSlot()); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | |
| | | // 生成进片任务 |
| | | initDownGlassTask(glassInfo, 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | } |
| | |
| | | log.info("G06、G11、G13分别为{},{}、{}非自动状态,无法出片", glassStatus06, glassStatus11, glassStatus13); |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | List<DownStorageCageDetails> tempList = downStorageCageDetailsService.list(new LambdaQueryWrapper<DownStorageCageDetails>() |
| | | .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | log.info("出片1、笼内的玻璃信息有:{}", tempList); |
| | | //获取待进片玻璃 |
| | | DownStorageCageDetails cageDetails = new DownStorageCageDetails(); |
| | | if (StringUtils.isNotBlank(glassId)) { |
| | |
| | | cageDetails.setSlot(empty.getSlot()); |
| | | tempList.add(cageDetails); |
| | | } |
| | | |
| | | log.info("笼内玻璃的数据有:{}", tempList); |
| | | log.info("出片2:笼内玻璃的数据(包括待进片)有:{}", tempList); |
| | | if (CollectionUtils.isEmpty(tempList)) { |
| | | log.info("笼内没有玻璃,无法执行出片"); |
| | | return Boolean.FALSE; |
| | | } |
| | | //优先走08片台的玻璃:走人工下片或者2号机械臂 |
| | | //1、08台忙碌,仅走1号机械臂 |
| | | //2、08台空闲,先走扔工下片或2号机械臂,无玻璃出片 在走1号机械臂 |
| | | //机械臂被禁用的情况下不能继续向禁用的机械臂放玻璃 |
| | | Boolean flag08 = "1".equals(out08Glassstate) ? Boolean.TRUE : Boolean.FALSE; |
| | | if (!flag08) { |
| | | generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId); |
| | |
| | | return generateTaskByShelf(glassStatus06, glassStatus11, !flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | } |
| | | } |
| | | |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | |
| | | log.info("架子已经占满,多层玻璃无法找到对应的格子,需执行替换玻璃的操作"); |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | } |
| | | if (downGlassInfoDTO.getLayer().equals(glassInfo.getLayer())) { |
| | | log.info("当前玻璃的流程在架子上落架最多 直接进片"); |
| | |
| | | glassStatus13, List<DownStorageCageDetails> tempList, DownStorageCageDetails cageDetails, String glassId) { |
| | | //获取2个机械臂范围内的架子绑定的流程卡信息 |
| | | List<Integer> workList = new ArrayList(); |
| | | |
| | | if (flag08) { |
| | | if (!"2".equals(glassStatus11)) { |
| | | workList.addAll(Const.G11_WORK_STATION); |
| | |
| | | List<Integer> workStationAll = Arrays.asList(1, 2, 3, 4, 5, 6); |
| | | List<Integer> offWorkStationList = workStationAll.stream().filter(e -> !workList.contains(e)).collect(Collectors.toList()); |
| | | List<DownStorageCageDetails> list = new ArrayList(); |
| | | //是否有空架子 true:有 false:无 |
| | | Boolean isEmptyShelf = Boolean.FALSE; |
| | | //对笼内玻璃进行过滤,仅出符合逻辑的玻璃 |
| | | if (CollectionUtils.isNotEmpty(workList)) { |
| | | List<DownWorkstation> downWorkstationList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getEnableState, Const.SLOT_ON).in(DownWorkstation::getWorkstationId, workList)); |
| | | // log.info("架子被禁用,无法出片落架"); |
| | | if (CollectionUtils.isEmpty(downWorkstationList)) { |
| | | log.info("笼子被禁用,无法走机械臂下片"); |
| | | //走人工下片 |
| | | if (!"2".equals(glassStatus13)) { |
| | | list = tempList.stream().filter(item -> item.getWidth() > maxWidth || item.getHeight() > maxHeight).collect(Collectors.toList()); |
| | | if (flag08 && !"2".equals(glassStatus13)) { |
| | | list = tempList.stream().filter(item -> { |
| | | double firstLength = Math.max(item.getWidth(), item.getHeight()); |
| | | double secondLength = Math.min(item.getWidth(), item.getHeight()); |
| | | return firstLength > maxWidth || secondLength > maxHeight; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } else { |
| | | //获取可落架的的架子信息(包括空架子) |
| | | List<DownWorkstation> workstationsIsNotBind = downWorkstationList.stream().filter(item -> null == (item.getFlowCardId())).collect(Collectors.toList()); |
| | | //将架子的流程卡号及层数作为key |
| | | //仅获取空架子信息 |
| | | List<DownWorkstation> workstationsIsNotBind = downWorkstationList.stream().filter(item -> StringUtils.isBlank(item.getFlowCardId())).collect(Collectors.toList()); |
| | | //将架子的流程卡号及层数作为key 不存在空架子的情况 |
| | | if (CollectionUtils.isEmpty(workstationsIsNotBind)) { |
| | | log.info("不存在未绑定流程卡架子"); |
| | | //筛选出对应架子已绑定流程卡可下片的玻璃 |
| | | Map<String, List<DownWorkstation>> listMap = downWorkstationList.stream() |
| | | .filter(item -> null != (item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | .filter(item -> StringUtils.isNotBlank(item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | //过滤筛选获取架子上对应流程卡+层数的笼子内的玻璃信息 |
| | | list = tempList.stream().filter(item -> listMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | } else { |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃,且未绑定架子的玻璃信息"); |
| | | //获取禁用架子的流程号,将笼内绑定架子且架子被禁用的流程卡信息 |
| | | |
| | | //获取禁用及非本机械臂的架子的流程号及层数对应的玻璃信息 |
| | | List<DownWorkstation> downWorkstationOffList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .and(i -> i.in(DownWorkstation::getWorkstationId, offWorkStationList).or().eq(DownWorkstation::getEnableState, Const.SLOT_OFF))); |
| | | //获取被禁用的流程卡信息 |
| | | //获取被禁用的流程卡信息 为空:将返回笼内的所有玻璃信息 |
| | | if (CollectionUtils.isEmpty(downWorkstationOffList)) { |
| | | list = tempList; |
| | | } else { |
| | | Map<String, List<DownWorkstation>> listOffMap = downWorkstationOffList.stream().filter(item -> null != (item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | //笼内存在无法出片的玻璃信息,过滤无法出片的玻璃信息,仅获取可出片的玻璃信息 无法出片的玻璃为:未绑定架子、绑定架子被禁用、非本机械臂对应的架子 |
| | | Map<String, List<DownWorkstation>> listOffMap = downWorkstationOffList.stream().filter(item -> StringUtils.isNotBlank(item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | list = tempList.stream().filter(item -> !listOffMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | } |
| | | //空架子表示置为true |
| | | isEmptyShelf = Boolean.TRUE; |
| | | //todo:如果禁用架子已绑定流程卡,因为时间不确定,笼子内的玻璃可重新绑定新架子 |
| | | // list = tempList.stream().filter(item -> !listMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | |
| | | } |
| | | } |
| | | } else { |
| | | if (flag08 && !"2".equals(glassStatus13)) { |
| | | //直接走人工下片 |
| | | list = tempList.stream().filter(item -> item.getWidth() > maxWidth || item.getHeight() > maxHeight).collect(Collectors.toList()); |
| | | list = tempList.stream().filter(item -> { |
| | | double firstLength = Math.max(item.getWidth(), item.getHeight()); |
| | | double secondLength = Math.min(item.getWidth(), item.getHeight()); |
| | | return firstLength > maxWidth || secondLength > maxHeight; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | if (CollectionUtils.isEmpty(list)) { |
| | |
| | | return Boolean.FALSE; |
| | | } |
| | | String tempGlassId = null; |
| | | Boolean isBind = Boolean.FALSE; |
| | | Boolean isNeedBind = Boolean.FALSE; |
| | | |
| | | for (DownStorageCageDetails item : list) { |
| | | if (item.getWidth() > maxWidth || item.getHeight() > maxHeight) { |
| | | double firstLength = Math.max(item.getWidth(), item.getHeight()); |
| | | double secondLength = Math.min(item.getWidth(), item.getHeight()); |
| | | if (firstLength > maxWidth || secondLength > maxHeight) { |
| | | if (flag08 && !"2".equals(glassStatus13)) { |
| | | log.info("玻璃宽度或高度超出阈值,执行人工下片"); |
| | | tempGlassId = item.getGlassId(); |
| | |
| | | //架子都未绑定流程卡,出笼内子数量最多尺寸最大的玻璃id,无 则返回扫描扫到的玻璃id进行出片 |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId, offWorkStationList); |
| | | |
| | | isBind = Boolean.TRUE; |
| | | isNeedBind = Boolean.TRUE; |
| | | break loop; |
| | | } |
| | | //将笼子内的玻璃进行过滤,仅获取无法落架的流程卡玻璃 |
| | |
| | | if (isEmptyShelf) { |
| | | //架子都未绑定流程卡,出笼内子数量最多尺寸最大的玻璃id,无 则返回扫描扫到的玻璃id进行出片 |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId, offWorkStationList); |
| | | isBind = Boolean.TRUE; |
| | | isNeedBind = Boolean.TRUE; |
| | | break loop; |
| | | } |
| | | } |
| | |
| | | DownGlassInfoDTO downGlassInfoDTO = downGlassInfoService.queryDownGlassMaxLayer(item.getFlowCardId()); |
| | | if (null == downGlassInfoDTO) { |
| | | // 历史落架玻璃按照相关流程卡取数据库未找到最多玻璃信息,表明当前流程卡下的有层的玻璃均未落架,直接可出当前玻璃 |
| | | log.info(""); |
| | | isBind = Boolean.FALSE; |
| | | tempGlassId = item.getGlassId(); |
| | | log.info("当前流程卡不存在落架的玻璃,可直接出片落架,玻璃id:{}", tempGlassId); |
| | | break loop; |
| | | } |
| | | if (downGlassInfoDTO.getLayer().equals(downGlassInfoDTO.getLayer())) { |
| | | log.info("当前玻璃的流程在架子上落架最多,直接出片"); |
| | | //更新玻璃状态,生成出片任务 |
| | | tempGlassId = item.getGlassId(); |
| | | isBind = Boolean.FALSE; |
| | | log.info("当前玻璃的流程在架子上落架最多,直接出片,玻璃id:{}", tempGlassId); |
| | | break loop; |
| | | } |
| | | Integer sequence = downGlassInfoService.queryMaxSequence(item.getFlowCardId(), item.getLayer()); |
| | |
| | | .eq(DownGlassInfo::getFlowCardId, downGlassInfoDTO.getFlowCardId()) |
| | | .eq(DownGlassInfo::getLayer, downGlassInfoDTO.getLayer()).eq(DownGlassInfo::getSequence, sequence)); |
| | | if (null != downGlassInfoDTO && downGlassInfo.getWidth() == item.getWidth() && downGlassInfo.getHeight() == item.getHeight()) { |
| | | log.info("相同次序玻璃对应上,可执行进片任务"); |
| | | //更新玻璃状态,生成出片任务 |
| | | tempGlassId = item.getGlassId(); |
| | | isBind = Boolean.FALSE; |
| | | log.info("相同次序玻璃对应上,可执行进片任务,玻璃id:{}", tempGlassId); |
| | | break loop; |
| | | } |
| | | } |
| | |
| | | List<DownStorageCageDetails> downStorageCageDetails = singleLayerMap.get(e.getFlowCardId() + e.getLayer()); |
| | | if (CollectionUtils.isNotEmpty(downStorageCageDetails)) { |
| | | tempGlassId = downStorageCageDetails.get(0).getGlassId(); |
| | | isBind = Boolean.FALSE; |
| | | break; |
| | | } |
| | | } |
| | |
| | | return Boolean.FALSE; |
| | | } else { |
| | | //按照出片的玻璃id更新笼内的玻璃状态为已出片 |
| | | return generateDownGlassOutTask(tempGlassId, Const.GLASS_CACHE_TYPE_OUT, isBind, cageDetails, workList); |
| | | return generateDownGlassOutTask(tempGlassId, Const.GLASS_CACHE_TYPE_OUT, isNeedBind, cageDetails, workList); |
| | | } |
| | | } |
| | | |
| | | public Boolean generateDownGlassOutTask(String glassId, Integer taskType, Boolean |
| | | isBind, DownStorageCageDetails cageDetails, List<Integer> workList) { |
| | | isNeedBind, DownStorageCageDetails cageDetails, List<Integer> workList) { |
| | | //按玻璃id获取玻璃信息 |
| | | DownStorageCageDetails downStorageCageDetails = null; |
| | | if (glassId.equals(cageDetails.getGlassId())) { |
| | |
| | | } |
| | | |
| | | Integer endCell = null; |
| | | if (isBind) { |
| | | if (isNeedBind) { |
| | | //获取空架子信息,将空架子信息绑定流程卡 |
| | | DownWorkstation emptyDownWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNull(DownWorkstation::getFlowCardId).in(DownWorkstation::getWorkstationId, workList).orderByDesc(DownWorkstation::getWorkstationId).last("limit 1")); |
| | | .and(on -> on.isNull(DownWorkstation::getFlowCardId).or().eq(DownWorkstation::getFlowCardId, "")).in(DownWorkstation::getWorkstationId, workList).orderByDesc(DownWorkstation::getWorkstationId).last("limit 1")); |
| | | if (null != emptyDownWorkstation) { |
| | | log.info("获取到空架子信息,绑定流程卡"); |
| | | downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), emptyDownWorkstation.getWorkstationId(), downStorageCageDetails.getLayer()); |
| | |
| | | //生成任务信息 |
| | | DownGlassInfo downGlassInfo = new DownGlassInfo(); |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //todo:落架片序 |
| | | //落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |