Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | package com.mes.edgglasstask.controller; |
| | | |
| | | |
| | | import com.mes.edgglasstask.entity.request.EdgGlassInfoRequest; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | |
| | | @RestController |
| | | @RequestMapping("/edgGlassTaskInfo") |
| | | public class EdgGlassTaskInfoController { |
| | | |
| | | @Autowired |
| | | EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | /** |
| | | * 设置磨边队列查询参数 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/setEdgGlassInfoRequest") |
| | | @ApiOperation(value = "设置磨边队列查询参数", notes = "设置磨边队列查询参数") |
| | | public Result<String> setEdgGlassInfoRequest(@RequestBody EdgGlassInfoRequest request) { |
| | | edgGlassTaskInfoService.setEdgGlassInfoRequest(request); |
| | | return Result.build(200, "查询成功", "1"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.mes.edgglasstask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | |
| | | private Integer line; |
| | | |
| | | private Date time; |
| | | |
| | | @TableLogic |
| | | private int deleted; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.entity.request.EdgGlassInfoRequest; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | |
| | | */ |
| | | public interface EdgGlassTaskInfoService extends IService<EdgGlassTaskInfo> { |
| | | |
| | | List<EdgGlassTaskInfo> selectEdgInfo(); |
| | | |
| | | String setEdgGlassInfoRequest(EdgGlassInfoRequest request); |
| | | /** |
| | | * 查询判断磨边线是否有玻璃运行 |
| | | * @param |
| | | * @return |
| | | */ |
| | | List<EdgGlassTaskInfo> selectTaskCacheIsRun(); |
| | | } |
| | |
| | | package com.mes.edgglasstask.service.impl; |
| | | |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.entity.request.EdgGlassInfoRequest; |
| | | import com.mes.edgglasstask.mapper.EdgGlassTaskInfoMapper; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.tools.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | |
| | | @Service |
| | | public class EdgGlassTaskInfoServiceImpl extends ServiceImpl<EdgGlassTaskInfoMapper, EdgGlassTaskInfo> implements EdgGlassTaskInfoService { |
| | | |
| | | @Autowired |
| | | RedisUtil redisUtil; |
| | | |
| | | @Override |
| | | public List<EdgGlassTaskInfo> selectEdgInfo() { |
| | | EdgGlassInfoRequest request = redisUtil.getCacheObject("edgGlassRequest"); |
| | | |
| | | if (null == request) { |
| | | request = new EdgGlassInfoRequest(); |
| | | } |
| | | if (null == request.getBeginDate()) { |
| | | request.setBeginDate(DateUtil.getBeginDate()); |
| | | request.setEndDate(DateUtil.getEndDate()); |
| | | } |
| | | LambdaQueryWrapper<EdgGlassTaskInfo> edgGlassWrapper = new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | .in(CollectionUtils.isNotEmpty(request.getCellList()), EdgGlassTaskInfo::getLine, request.getCellList()) |
| | | .in(CollectionUtils.isNotEmpty(request.getStateList()), EdgGlassTaskInfo::getStatus, request.getStateList()) |
| | | .between(null != request.getBeginDate(), EdgGlassTaskInfo::getTime, request.getBeginDate(), request.getEndDate()) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | return this.list(edgGlassWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public String setEdgGlassInfoRequest(EdgGlassInfoRequest request) { |
| | | if (request == null) { |
| | | redisUtil.deleteObject("edgGlassRequest"); |
| | | } else { |
| | | redisUtil.setCacheObject("edgGlassRequest", request); |
| | | } |
| | | return "success"; |
| | | } |
| | | |
| | | /** |
| | | * 查询判断磨边线是否有玻璃运行 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EdgGlassTaskInfo> selectTaskCacheIsRun() { |
| | | QueryWrapper<EdgGlassTaskInfo> wrapper = new QueryWrapper<EdgGlassTaskInfo>() |
| | | .select("line") |
| | | .eq("status", 1) |
| | | .groupBy("line"); |
| | | |
| | | return this.list(wrapper); |
| | | } |
| | | } |
| | |
| | | package com.mes.edgstoragecage.controller; |
| | | |
| | | import com.mes.edgglasstask.entity.request.IdentWornRequest; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageServiceImpl; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.impl.TaskCacheServiceImpl; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.awt.image.ImageProducer; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | |
| | | @ApiOperation("查询磨边缓存理片笼内详情 参数()") |
| | | @PostMapping("/selectEdgStorageCage") |
| | | @ResponseBody |
| | | public Result selectEdgStorageCage() { |
| | | List<Map<String, Object>> list = edgStorageCageService.selectEdgStorageCages(); |
| | | return Result.build(200, "成功", list); |
| | | public Result selectEdgStorageCage () { |
| | | List<Map<String, Object>> list=edgStorageCageService.selectEdgStorageCages(); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | |
| | | // @ApiOperation("添加磨边缓存理片笼信息 功能:笼内绑定玻璃 参数(EdgStorageCage edgStorageCage)") |
| | | // @PostMapping("/insertEdgStorageCage") |
| | | // @ResponseBody |
| | | // public Result insertEdgStorageCage(@RequestBody EdgStorageCage edgStorageCage) { |
| | | // boolean isSucess=edgStorageCageService.updateEdgStorageCage(edgStorageCage); |
| | | // return Result.build(200,"添加成功",1); |
| | | // } |
| | | @ApiOperation("修改磨边缓存理片笼信息 功能:对笼内栅格进行【启用/禁用】") |
| | | @PostMapping("/updateEdgStorageCage") |
| | | @ResponseBody |
| | | public Result updateEdgStorageCage(@RequestBody EdgStorageCage edgStorageCage) { |
| | | String isSucess = edgStorageCageService.updateEdgStorageCage(edgStorageCage) ? "成功" : "失败"; |
| | | return Result.build(200, "【启用/禁用】" + isSucess, 1); |
| | | String isSucess=edgStorageCageService.updateEdgStorageCage(edgStorageCage)?"成功":"失败"; |
| | | return Result.build(200,"【启用/禁用】"+isSucess,1); |
| | | } |
| | | |
| | | @ApiOperation("磨边缓存理片笼信息 功能:对笼内栅格玻璃进行【清除/更换/绑定】 EdgStorageCage格子信息,EdgStorageCageDetails 玻璃信息 ") |
| | | @PostMapping("/edgStorageCageGlass") |
| | | @ResponseBody |
| | | public Result edgStorageCageGlass(@RequestBody EdgStorageCageDetails edgStorageCageDetails, int edgStorageCageId) { |
| | | public Result edgStorageCageGlass(@RequestBody EdgStorageCageDetails edgStorageCageDetails,int edgStorageCageId) { |
| | | |
| | | String isSucess = edgStorageCageService.updateEdgStorageCageDetails(edgStorageCageId, edgStorageCageDetails) ? "成功" : "失败"; |
| | | return Result.build(200, "【清除/更换/绑定】" + isSucess, 1); |
| | | String isSucess=edgStorageCageService.updateEdgStorageCageDetails(edgStorageCageId,edgStorageCageDetails)?"成功":"失败"; |
| | | return Result.build(200,"【清除/更换/绑定】"+isSucess,1); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("磨边模块汇报玻璃状态 功能:对笼内栅格玻璃进行【破损/拿走】 ") |
| | | @PostMapping("/edgReportStatus") |
| | | @ResponseBody |
| | | public Result edgReportStatus(@RequestBody @Validated IdentWornRequest request) { |
| | | return Result.build(200, "【破损/拿走】" + edgStorageCageDetailsService.edgReportStatus(request), 1); |
| | | public Result edgReportStatus(@RequestBody Map<String, Object> arguments) { |
| | | /*arguments.put("line","1002"); |
| | | arguments.put("machine","卧式理片");*/ |
| | | String isSucess=edgStorageCageDetailsService.identWorn(arguments)?"成功":"失败"; |
| | | return Result.build(200,"【破损/拿走】"+isSucess,1); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.edgstoragecage.service; |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.edgglasstask.entity.request.IdentWornRequest; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | |
| | | import java.util.List; |
| | |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageDetailsService extends MPJBaseService<EdgStorageCageDetails> { |
| | | |
| | | /** |
| | | * 识别 破损/拿走 |
| | | * @param arguments |
| | | * @return |
| | | */ |
| | | boolean identWorn(Map<String, Object> arguments); |
| | | |
| | | /** |
| | | * 获取 切割当前版图 |
| | |
| | | |
| | | /** |
| | | * 获取出片信息数据 |
| | | * |
| | | * @param glassId |
| | | * @param threshold |
| | | * @return |
| | | */ |
| | | EdgStorageCageDetails selectOutGlass(String glassId, int threshold); |
| | | |
| | | /** |
| | | * 识别 拿走:9/破损:8 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | String identControls(IdentWornRequest request); |
| | | |
| | | /** |
| | | * 磨边模块汇报玻璃状态 功能:对笼内栅格玻璃进行【破损/拿走】 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | String edgReportStatus(IdentWornRequest request); |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJLambdaQueryWrapper; |
| | |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.mapper.DamageMapper; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.entity.request.IdentWornRequest; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.mapper.EngineeringMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import com.mes.pp.entity.OptimizeLayout; |
| | |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | 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; |
| | |
| | | @Autowired |
| | | EdgStorageCageMapper edgStorageCageMapper; |
| | | @Autowired |
| | | DamageMapper damageMapper; |
| | | |
| | | @Autowired |
| | | EngineeringMapper engineeringMapper; |
| | | |
| | | @Autowired |
| | | GlassInfoMapper glassInfoMapper; |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | DamageService damageService; |
| | | |
| | | @Autowired |
| | | EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | /** |
| | | * 识别 拿走:200/破损:201 |
| | | * |
| | | * @param arguments |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean identWorn(Map<String,Object> arguments) { |
| | | String glassId=arguments.get("glassId").toString(); |
| | | int state=arguments.get("state").toString().isEmpty()?0:Integer.parseInt(arguments.get("state").toString()); |
| | | int line=arguments.get("line").toString().isEmpty()?0:Integer.parseInt(arguments.get("line").toString()); |
| | | String workingProcedure=arguments.get("workingProcedure").toString(); |
| | | if(state==0||line==0||workingProcedure==null||glassId==null||glassId.isEmpty()){ |
| | | log.info("前端传递数据不全:{}",arguments); |
| | | return false; |
| | | } |
| | | List<GlassInfo> GlassInfos = glassInfoMapper.selectList(new MPJLambdaQueryWrapper<GlassInfo>() |
| | | .selectAll(GlassInfo.class) |
| | | .eq(GlassInfo::getGlassId, glassId)); |
| | | if (GlassInfos.size() == 1) { |
| | | Damage damage =new Damage(); |
| | | damage.setGlassId(glassId); |
| | | damage.setLine(line); |
| | | damage.setWorkingProcedure(workingProcedure); |
| | | damage.setRemark(""); |
| | | damage.setStatus(state);//8破损,9拿走 |
| | | damageService.insertDamage(damage); |
| | | }else{ |
| | | return false; |
| | | } |
| | | List<EdgStorageCageDetails> edgStorageCageDetails = baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | if (edgStorageCageDetails.size() == 1) { |
| | | EdgStorageCageDetails item = edgStorageCageDetails.get(0); |
| | | item.setState(state); |
| | | baseMapper.update(item, new MPJLambdaWrapper<EdgStorageCageDetails>().selectAll(EdgStorageCageDetails.class).eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取 切割当前版图 |
| | |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectCutTerritory() { |
| | | List<UpPattenUsage> upPattenUsage = upPattenUsageMapper.selectList(new MPJLambdaWrapper<UpPattenUsage>() |
| | | List<UpPattenUsage> upPattenUsage=upPattenUsageMapper.selectJoinList(UpPattenUsage.class, new MPJLambdaWrapper<UpPattenUsage>() |
| | | .selectAll(UpPattenUsage.class) |
| | | .innerJoin(Engineering.class, on -> on |
| | | .eq(Engineering::getEngineerId, UpPattenUsage::getEngineeringId)) |
| | | .eq(Engineering::getState,1) |
| | | .orderByDesc(UpPattenUsage::getState) |
| | | .orderByDesc(UpPattenUsage::getId)); |
| | | .orderByDesc(UpPattenUsage::getId) |
| | | ); |
| | | if (!upPattenUsage.isEmpty()) { |
| | | UpPattenUsage upPattenUsage1 = upPattenUsage.get(0); |
| | | List<Map<String, Object>> cutTerritorys = optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class) |
| | | List<Map<String, Object>> cutTerritorys=optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class) |
| | | .selectAll(OptimizeDetail.class) |
| | | .selectAs(OptimizeLayout::getWidth, "olWidth") |
| | | .selectAs(OptimizeLayout::getHeight, "olHeight") |
| | |
| | | .eq(OptimizeDetail::getProjectNo, upPattenUsage1.getEngineeringId()) |
| | | .eq(OptimizeDetail::getStockId, upPattenUsage1.getLayoutSequence()) |
| | | ); |
| | | List<Map<String, Object>> ResultcutTerritorys = new ArrayList<>(); |
| | | for (Map<String, Object> cutTerritory : cutTerritorys) { |
| | | EdgStorageCageDetails edgStorageCageDetails = baseMapper.selectOne(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getGlassId, cutTerritory.get("glass_id")) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | // log.info("内容:{}-------{}",cutTerritory,edgStorageCageDetails); |
| | | if (edgStorageCageDetails != null) { |
| | | cutTerritory.put("glass_state", edgStorageCageDetails.getState()); |
| | | } else { |
| | | cutTerritory.put("glass_state", 0); |
| | | } |
| | | ResultcutTerritorys.add(cutTerritory); |
| | | } |
| | | return ResultcutTerritorys; |
| | | Map<String, EdgStorageCageDetails> edgMaps=baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getEngineerId,upPattenUsage1.getEngineeringId()) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | ).stream().collect(Collectors.toMap(EdgStorageCageDetails::getGlassId,EdgStorageCageDetails->EdgStorageCageDetails)); |
| | | |
| | | // Sql版本 |
| | | // return optimizeDetailMapper.selectJoinMaps(new MPJQueryWrapper<OptimizeDetail>().selectAll(OptimizeDetail.class) |
| | | // .select("ol.width as olwidth","ol.height as olheight") |
| | | // .leftJoin("optimize_layout ol on t.project_no=ol.project_no and t.stock_id=ol.stock_id") |
| | | // .eq("t.project_no", upPattenUsage1.getEngineeringId()) |
| | | // .eq("t.stock_id",upPattenUsage1.getLayoutSequence()) |
| | | // ); |
| | | Map<String, Damage> damageMaps=damageMapper.selectList(new MPJLambdaQueryWrapper<Damage>() |
| | | .selectAll(Damage.class) |
| | | .eq(Damage::getEngineerId,upPattenUsage1.getEngineeringId()) |
| | | ).stream().collect(Collectors.toMap(Damage::getGlassId,Damage->Damage,(V1,V2)->V2)); |
| | | |
| | | List<Map<String, Object>> resultCutTerritory=new ArrayList<>(); |
| | | 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 if(damageMaps.get(cutTerritory.get("glass_id"))!=null){ |
| | | //log.info("玻璃已破损/拿走-----内容:{}",damageMaps.get(item.get("glass_id"))); |
| | | cutTerritory.put("glass_state",damageMaps.get(cutTerritory.get("glass_id")).getStatus()); |
| | | }else{ |
| | | cutTerritory.put("glass_state",0); |
| | | } |
| | | resultCutTerritory.add(cutTerritory); |
| | | } |
| | | return resultCutTerritory; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | @Override |
| | | public List<List<Map<String, Object>>> selectCurrentCutTerritory(String current) { |
| | | //结果 |
| | | List<Map<String, Object>> ResultcutTerritorys = new ArrayList<>(); |
| | | List<Map<String, Object>> resultCutTerritory=new ArrayList<>(); |
| | | //此工程的所有优化数据 |
| | | List<Map<String, Object>> cutTerritorys = optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class) |
| | | List<Map<String, Object>> cutTerritory=optimizeDetailMapper.selectJoinMaps(JoinWrappers.lambda(OptimizeDetail.class) |
| | | .selectAll(OptimizeDetail.class) |
| | | .selectAs(OptimizeLayout::getWidth, "olWidth") |
| | | .selectAs(OptimizeLayout::getHeight, "olHeight") |
| | |
| | | .eq(OptimizeDetail::getProjectNo, current) |
| | | ); |
| | | |
| | | Map<String, EdgStorageCageDetails> edgMaps = baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | Map<String, EdgStorageCageDetails> edgMaps=baseMapper.selectList(new MPJLambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .selectAll(EdgStorageCageDetails.class) |
| | | .eq(EdgStorageCageDetails::getEngineerId, current) |
| | | .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) { |
| | | ).stream().collect(Collectors.toMap(EdgStorageCageDetails::getGlassId,EdgStorageCageDetails->EdgStorageCageDetails,(V1,V2)->V2)); |
| | | |
| | | Map<String, Damage> damageMaps=damageMapper.selectList(new MPJLambdaQueryWrapper<Damage>() |
| | | .selectAll(Damage.class) |
| | | .eq(Damage::getEngineerId,current) |
| | | ).stream().collect(Collectors.toMap(Damage::getGlassId,Damage->Damage)); |
| | | |
| | | for (Map<String, Object> item : cutTerritory) { |
| | | // log.info("内容:{}-------{}",cutTerritory,edgStorageCageDetails); |
| | | if (cutTerritory.get("glass_id") == null || "".equals(cutTerritory.get("glass_id"))) { |
| | | log.info("优化数据中glassId存在空值-----内容:{}", cutTerritorys); |
| | | if(item.get("glass_id")==null||"".equals(item.get("glass_id"))){ |
| | | log.info("优化数据中glassId存在空值-----内容:{}",cutTerritory); |
| | | 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); |
| | | }else if(edgMaps.get(item.get("glass_id"))!=null){ |
| | | item.put("glass_state",edgMaps.get(item.get("glass_id")).getState()); |
| | | }else if(damageMaps.get(item.get("glass_id"))!=null){ |
| | | //log.info("玻璃已破损/拿走-----内容:{}",damageMaps.get(item.get("glass_id"))); |
| | | item.put("glass_state",damageMaps.get(item.get("glass_id")).getStatus()); |
| | | }else{ |
| | | item.put("glass_state",0); |
| | | } |
| | | ResultcutTerritorys.add(cutTerritory); |
| | | resultCutTerritory.add(item); |
| | | } |
| | | Map<String, List<Map<String, Object>>> groupBy = ResultcutTerritorys.stream().collect(Collectors.groupingBy(item -> item.get("stock_id").toString())); |
| | | Map<String, List<Map<String, Object>>> groupBy=resultCutTerritory.stream().collect(Collectors.groupingBy(item->item.get("stock_id").toString())); |
| | | // List<List<Map<String, Object>>> Result=groupBy.values().stream().collect(Collectors.toList()); |
| | | return new ArrayList<>(groupBy.values()); |
| | | //Sql版本 |
| | | // return optimizeDetailMapper.selectJoinMaps(new MPJQueryWrapper<OptimizeDetail>().selectAll(OptimizeDetail.class) |
| | | // .select("ol.width as olwidth","ol.height as olheight") |
| | | // .leftJoin("optimize_layout ol on t.project_no=ol.project_no and t.stock_id=ol.stock_id") |
| | | // .eq("t.project_no",current) |
| | | // ); |
| | | } |
| | | |
| | | /** |
| | |
| | | EdgStorageCageDetails outEdgStorageCageDetails = null; |
| | | |
| | | // if (queryMaxMinDiff(threshold)) |
| | | //todo:逻辑1:获取两条线已出最后一块玻璃在笼内相同尺寸所剩数量,优先走数量少的线 |
| | | //todo:需要在卧式理片笼详情表中新增状态,用来表示玻璃进出理片笼情况 |
| | | if (oldEdgStorageCageDetails != null && minTemperingLayoutId != null) { |
| | | log.info("按照上一片已出玻璃宽度{},高度{},及版图id区间{}到{}获取出片任务玻璃信息", oldEdgStorageCageDetails.getWidth() |
| | | , oldEdgStorageCageDetails.getHeight(), minTemperingLayoutId.getTemperingLayoutId(), minTemperingLayoutId.getTemperingLayoutId() + threshold); |
| | | outEdgStorageCageDetails = this.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .notIn(CollectionUtils.isNotEmpty(glassIds), EdgStorageCageDetails::getGlassId, glassIds) |
| | | .eq(EdgStorageCageDetails::getWidth, oldEdgStorageCageDetails.getWidth()) |
| | | .eq(EdgStorageCageDetails::getHeight, oldEdgStorageCageDetails.getHeight()) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | .last("limit 1")); |
| | | log.info("出片任务的玻璃信息:{}", outEdgStorageCageDetails); |
| | | } |
| | | //todo:逻辑1:获取两条线已出最后一块玻璃在笼内相同尺寸所剩数量,优先走数量少的线 |
| | | //todo:需要在卧式理片笼详情表中新增状态,用来表示玻璃进出理片笼情况 |
| | | if (oldEdgStorageCageDetails != null && minTemperingLayoutId != null) { |
| | | log.info("按照上一片已出玻璃宽度{},高度{},及版图id区间{}到{}获取出片任务玻璃信息", oldEdgStorageCageDetails.getWidth() |
| | | , oldEdgStorageCageDetails.getHeight(), minTemperingLayoutId.getTemperingLayoutId(), minTemperingLayoutId.getTemperingLayoutId() + threshold); |
| | | outEdgStorageCageDetails = this.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .notIn(CollectionUtils.isNotEmpty(glassIds), EdgStorageCageDetails::getGlassId, glassIds) |
| | | .eq(EdgStorageCageDetails::getWidth, oldEdgStorageCageDetails.getWidth()) |
| | | .eq(EdgStorageCageDetails::getHeight, oldEdgStorageCageDetails.getHeight()) |
| | | .orderByAsc(EdgStorageCageDetails::getTemperingLayoutId, EdgStorageCageDetails::getTemperingFeedSequence) |
| | | .last("limit 1")); |
| | | log.info("出片任务的玻璃信息:{}", outEdgStorageCageDetails); |
| | | } |
| | | if (outEdgStorageCageDetails == null) { |
| | | outEdgStorageCageDetails = minTemperingLayoutId; |
| | | } |
| | | return outEdgStorageCageDetails; |
| | | } |
| | | |
| | | @Override |
| | | public String identControls(IdentWornRequest request) { |
| | | //将识别破损的玻璃直接加入破损表 |
| | | Damage damage = new Damage(); |
| | | BeanUtils.copyProperties(request, damage); |
| | | damage.setType(request.getState()); |
| | | damage.setRemark(""); |
| | | damage.setStatus(0); |
| | | damageService.insertDamage(damage); |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public String edgReportStatus(IdentWornRequest request) { |
| | | //将磨边队列破损的玻璃直接加入破损表 |
| | | Damage damage = new Damage(); |
| | | BeanUtils.copyProperties(request, damage); |
| | | damage.setType(request.getState()); |
| | | damage.setRemark(""); |
| | | damage.setStatus(0); |
| | | damageService.insertDamage(damage); |
| | | //修改磨边队列数据状态 |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getStatus, request.getState()).eq(EdgGlassTaskInfo::getGlassId, request.getGlassId())); |
| | | return "success"; |
| | | } |
| | | } |
| | |
| | | EdgStorageCageDetails edgDItem = edgStorageCageDetailsMapper.selectById(edgStorageCageDetails.getId()); |
| | | if (edgItem != null) { |
| | | //移除 (破损,目前两个概念混合在一起,建议拆开) |
| | | EdgStorageCageDetails result = edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot, edgStorageCageId)); |
| | | EdgStorageCageDetails result = edgStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getSlot, edgStorageCageId)); |
| | | if (result != null) { |
| | | int state=8; |
| | | result.setSlot(0); |
| | | result.setState(201); |
| | | result.setState(state); |
| | | Damage damage =new Damage(); |
| | | damage.setGlassId(edgStorageCageDetails.getGlassId()); |
| | | damage.setLine(1002); |
| | | damage.setWorkingProcedure("卧式理片"); |
| | | damage.setStatus(2); |
| | | damage.setStatus(state); |
| | | damageService.insertDamage(damage); |
| | | edgStorageCageDetailsMapper.updateById(result); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | |
| | | |
| | | @Autowired |
| | | WebSocketServer webServerService; |
| | | @Autowired |
| | | DamageService damageService; |
| | | |
| | | @Value("${mes.threshold}") |
| | | private int threshold; |
| | |
| | | |
| | | public static String engineerId = ""; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | | Date startDate = new Date(); |
| | | log.info("本次任务开始执行时间:{}", startDate); |
| | |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("卧式理片破损玻璃清除任务开始执行时间:{}", startDate); |
| | | List<TaskCache> taskCacheList = taskCacheService.list(new LambdaQueryWrapper<TaskCache>().in(TaskCache::getTaskStatus, Const.GLASS_STATE_DAMAGE_TAKE) |
| | | .in(TaskCache::getTaskType, Const.GLASS_CACHE_TYPE_OUT_ALL)); |
| | | if (CollectionUtils.isNotEmpty(taskCacheList)) { |
| | | //获取破损/拿走玻璃id |
| | | List<String> glassList = taskCacheList.stream().map(TaskCache::getGlassId).collect(Collectors.toList()); |
| | | //将磨边队列的数据删除 |
| | | edgGlassTaskInfoService.remove(new LambdaQueryWrapper<EdgGlassTaskInfo>().in(EdgGlassTaskInfo::getGlassId, glassList)); |
| | | //将任务表中的数据删除 |
| | | taskCacheService.remove(new LambdaQueryWrapper<TaskCache>().in(TaskCache::getGlassId, glassList).in(TaskCache::getTaskType, Const.GLASS_CACHE_TYPE_OUT_ALL)); |
| | | List<Damage> damageList = taskCacheList.stream().map(e -> { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(e.getGlassId()); |
| | | damage.setLine(e.getEndCell()); |
| | | damage.setWorkingProcedure("冷加工"); |
| | | damage.setRemark("磨边前卧式理片"); |
| | | damage.setStatus(0); |
| | | damage.setType(e.getTaskStatus()); |
| | | return damage; |
| | | }).collect(Collectors.toList()); |
| | | damageService.batchInsertDamage(damageList); |
| | | 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"); |
| | | } |
| | | } |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 进片任务 |
| | |
| | | |
| | | //查询玻璃并进行交换 |
| | | GlassInfo glassInfo = queryAndChangeGlass(glassId); |
| | | if (glassInfo == null) { |
| | | return; |
| | | } |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | log.info("3、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | EdgStorageCageDetails details = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(Const.GLASS_STATE_IN); |
| | | details.setSlot(nearestEmpty.getSlot()); |
| | | details.setDeviceId(nearestEmpty.getDeviceId()); |
| | | edgStorageCageDetailsService.save(details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | log.info("4、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | //添加进片任务 |
| | | boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | log.info("6、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | log.info("5、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | |
| | | S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1); |
| | | log.info("7、发送确认字完成"); |
| | | log.info("6、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | // .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); |
| | | Assert.isFalse(null == glassInfo, "玻璃信息不存在"); |
| | | if ((glassInfo.getWidth() < Double.parseDouble(minTwoFirstLength) && glassInfo.getHeight() < Double.parseDouble(minTwoSecondLength)) || (glassInfo.getWidth() < Double.parseDouble(minTwoSecondLength) && glassInfo.getHeight() < Double.parseDouble(minTwoFirstLength))) { |
| | | log.info("3、玻璃信息不符合进入理片笼最小尺寸,玻璃信息为{}", glassInfo); |
| | | return null; |
| | | } |
| | | //按照玻璃尺寸 |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getWidth, glassInfo.getWidth()) |
| | |
| | | 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 >= " + minOneFirstLength + " and t1.second_length >= " + minOneSecondLength + ")"); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >= " + minOneFirstLength + " and t1.second_length >= " + minOneSecondLength); |
| | | } 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 " + |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加磨边队列信息 |
| | | * 添加理片笼任务 |
| | | * |
| | | * @param glassInfo |
| | | * @param endcell |
| | |
| | | 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<EdgGlassTaskInfo> edgTasks = edgGlassTaskInfoService.selectEdgInfo(); |
| | | jsonObject.append("edgTasks", edgTasks); |
| | | List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001"); |
| | | List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002"); |
| | | jsonObject.append("EdgTasks1", EdgTasks1); |
| | | jsonObject.append("EdgTasks2", EdgTasks2); |
| | | |
| | | //卧室缓存笼内信息 |
| | | List<Map<String, Object>> EdgStorageCageinfos = edgStorageCageService.selectEdgStorageCages(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void cacheGlassIsRun() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<EdgGlassTaskInfo> taskCaches = edgGlassTaskInfoService.selectTaskCacheIsRun(); |
| | | List<TaskCache> taskCaches = taskCacheService.selectTaskCacheIsRun(); |
| | | jsonObject.append("taskCaches", taskCaches); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlassIsRun"); |
| | | if (sendwServer != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.taskcache.controller; |
| | | |
| | | import com.mes.edgglasstask.entity.request.IdentWornRequest; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.mes.job.CacheGlassTask.engineerId; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | |
| | | private EdgStorageCageDetailsService edgStorageCageDetailsService; |
| | | |
| | | @Autowired |
| | | private EdgStorageCageService edgStorageCageService; |
| | | @Autowired |
| | | private TaskCacheService taskCacheService; |
| | | |
| | | @ApiOperation("查询切割版图信息-根据 工程号 参数(工程号)") |
| | |
| | | public Result cutTerritory(String current) { |
| | | //engineerId=current; |
| | | List<List<Map<String, Object>>> h = edgStorageCageDetailsService.selectCurrentCutTerritory(current); |
| | | return Result.build(200, "成功", h); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | | |
| | | @ApiOperation("识别显示 当前版图 参数()") |
| | | @PostMapping("/currentCutTerritory") |
| | | @ResponseBody |
| | | public Result currentCutTerritory() { |
| | | List<Map<String, Object>> h = edgStorageCageDetailsService.selectCutTerritory(); |
| | | return Result.build(200, "成功", h); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | | |
| | | @ApiOperation("识别操作: 破损/拿走 参数(ID,功能[9:拿走,8:破损])") |
| | | @ApiOperation("识别操作: 破损/拿走 参数(ID,功能[200:拿走,201:破损])") |
| | | @PostMapping("/identControls") |
| | | @ResponseBody |
| | | public Result<String> identControls(@RequestBody @Validated IdentWornRequest request) { |
| | | return Result.build(200, "成功", edgStorageCageDetailsService.identControls(request)); |
| | | public Result identControls(@RequestBody Map<String, Object> arguments) { |
| | | boolean issucess = edgStorageCageDetailsService.identWorn(arguments); |
| | | return Result.build(200,"成功",issucess); |
| | | } |
| | | |
| | | @ApiOperation("磨边任务 参数()") |
| | | @PostMapping("/selectEdgTask") |
| | | @ResponseBody |
| | | public Result selectEdgTask(@RequestBody Map<String, String> arguments) { |
| | | String line = arguments.get("line"); |
| | | List<Map<String, Object>> EdgTasks = taskCacheService.selectEdgInfo(line); |
| | | return Result.build(200, "成功", EdgTasks); |
| | | String line=arguments.get("line"); |
| | | List<Map<String,Object>> EdgTasks = taskCacheService.selectEdgInfo(line); |
| | | return Result.build(200,"成功",EdgTasks); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.taskcache.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | @TableLogic |
| | | private int deleted; |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | TaskCache selectLastOutCacheInfo(int line); |
| | | |
| | | /** |
| | | * 查询判断磨边线是否有玻璃运行 |
| | | * @param |
| | | * @return |
| | | */ |
| | | List<TaskCache> selectTaskCacheIsRun(); |
| | | |
| | | } |
| | |
| | | package com.mes.taskcache.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | |
| | | |
| | | /** |
| | | * 添加理片笼任务 |
| | | * |
| | | * @param taskCache |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean insertTaskCache(TaskCache taskCache) { |
| | | public boolean insertTaskCache(TaskCache taskCache){ |
| | | baseMapper.insert(taskCache); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查询磨边任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectEdgInfo(String line) { |
| | | List<TaskCache> taskCache = baseMapper.selectList(new MPJLambdaWrapper<TaskCache>() |
| | | public List<Map<String,Object>> selectEdgInfo(String line) { |
| | | List<TaskCache> taskCache=baseMapper.selectList(new MPJLambdaWrapper<TaskCache>() |
| | | .selectAll(TaskCache.class) |
| | | .eq(TaskCache::getEndCell, line) |
| | | .eq(TaskCache::getTaskStatus, 1) |
| | | .eq(TaskCache::getTaskStatus,1) |
| | | .orderByAsc(TaskCache::getCreateTime)); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | int serialNumber = 1; |
| | | for (TaskCache taskCache1 : taskCache) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String,Object>> result=new ArrayList<>(); |
| | | int serialNumber=1; |
| | | for(TaskCache taskCache1:taskCache){ |
| | | Map<String,Object> map=new HashMap<>(); |
| | | // GlassInfo glassInfo=glassInfoMapper.selectOne(new MPJLambdaWrapper<GlassInfo>() |
| | | // .selectAll(GlassInfo.class) |
| | | // .eq(GlassInfo::getGlassId,taskCache1.getGlassId())); |
| | | List<GlassInfo> glassInfos = glassInfoMapper.selectJoinList(GlassInfo.class, new MPJLambdaWrapper<GlassInfo>() |
| | | List<GlassInfo> glassInfos=glassInfoMapper.selectJoinList(GlassInfo.class, new MPJLambdaWrapper<GlassInfo>() |
| | | .selectAll(GlassInfo.class) |
| | | .innerJoin(EdgStorageCageDetails.class, on -> on |
| | | .eq(EdgStorageCageDetails::getGlassId, GlassInfo::getGlassId) |
| | | .eq(EdgStorageCageDetails::getEngineerId, GlassInfo::getEngineerId)) |
| | | .eq(GlassInfo::getGlassId, taskCache1.getGlassId()) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .eq(GlassInfo::getGlassId,taskCache1.getGlassId()) |
| | | .eq(EdgStorageCageDetails::getState,Const.GLASS_STATE_OUT) |
| | | ); |
| | | if (glassInfos.size() == 1) { |
| | | GlassInfo glassInfo = glassInfos.get(0); |
| | | map.put("Line", line);//线路 2001 1线, 2002 2线 |
| | | map.put("Width", glassInfo.getWidth());//宽 |
| | | map.put("Height", glassInfo.getHeight());//高 |
| | | map.put("Thickness", glassInfo.getThickness());//厚 |
| | | map.put("GlassId", glassInfo.getGlassId());//玻璃ID |
| | | map.put("FlowCardId", glassInfo.getFlowCardId());//流程卡号 |
| | | map.put("TemperingLayoutId", glassInfo.getTemperingLayoutId());// 暂不显示 钢化版图ID |
| | | map.put("TemperingFeedSequence", glassInfo.getTemperingFeedSequence());// 暂不显示 钢化版图ID内的序号 |
| | | map.put("FilmsId", glassInfo.getFilmsid());//膜系 |
| | | map.put("SerialNumber", serialNumber);//出片顺序 |
| | | if(glassInfos.size()==1){ |
| | | GlassInfo glassInfo=glassInfos.get(0); |
| | | map.put("Line",line);//线路 2001 1线, 2002 2线 |
| | | map.put("Width",glassInfo.getWidth());//宽 |
| | | map.put("Height",glassInfo.getHeight());//高 |
| | | map.put("Thickness",glassInfo.getThickness());//厚 |
| | | map.put("GlassId",glassInfo.getGlassId());//玻璃ID |
| | | map.put("FlowCardId",glassInfo.getFlowCardId());//流程卡号 |
| | | map.put("TemperingLayoutId",glassInfo.getTemperingLayoutId());// 暂不显示 钢化版图ID |
| | | map.put("TemperingFeedSequence",glassInfo.getTemperingFeedSequence());// 暂不显示 钢化版图ID内的序号 |
| | | map.put("FilmsId",glassInfo.getFilmsid());//膜系 |
| | | map.put("SerialNumber",serialNumber);//出片顺序 |
| | | result.add(map); |
| | | } else if (glassInfos.size() > 1) { |
| | | log.info("数据不符合逻辑--磨边队列glassId重复:", glassInfos); |
| | | }else if(glassInfos.size()>1){ |
| | | log.info("数据不符合逻辑--磨边队列glassId重复:",glassInfos); |
| | | return new ArrayList<>(); |
| | | } |
| | | serialNumber++; |
| | |
| | | |
| | | /** |
| | | * 查询待理片工作的任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectCacheInfo() { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus, 0)); |
| | | public List<TaskCache> selectCacheInfo(){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus,0)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("task_status",0)); |
| | | } |
| | | |
| | | /** |
| | | * 查询全部任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 查询待进片任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectInputTaskCache() { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus, 0).eq(TaskCache::getTaskType, 1)); |
| | | public List<TaskCache> selectInputTaskCache(){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus,0).eq(TaskCache::getTaskType,1)); |
| | | |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("task_status",0).eq("task_type",1)); |
| | | } |
| | | |
| | | /** |
| | | * 查询待出片任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectOutTaskCache() { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus, 0).eq(TaskCache::getTaskType, 2)); |
| | | public List<TaskCache> selectOutTaskCache(){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getTaskStatus,0).eq(TaskCache::getTaskType,2)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("task_status",0).eq("task_type",2)); |
| | | } |
| | | |
| | | /** |
| | | * 查询 A09 或 A10 最新的一片 出片任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TaskCache> selectLastOutCacheInfos(int line) { |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell, line).eq(TaskCache::getTaskStatus, 1).orderByDesc(TaskCache::getCreateTime)); |
| | | public List<TaskCache> selectLastOutCacheInfos(int line){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell,line).eq(TaskCache::getTaskStatus,1).orderByDesc(TaskCache::getCreateTime)); |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("end_cell",line).eq("task_status",1).orderByDesc("ID")); |
| | | } |
| | | |
| | | /** |
| | | * 查询 A09 或 A10 最新的一片 出片任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TaskCache selectLastOutCacheInfo(int line) { |
| | | return baseMapper.selectOne(new MPJLambdaWrapper<TaskCache>().selectAll(TaskCache.class).eq(TaskCache::getEndCell, line).eq(TaskCache::getTaskStatus, 1).orderByDesc(TaskCache::getCreateTime)); |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | active: prod |
| | | application: |
| | | name: cacheGlass |
| | | mybatis-plus: |
| | |
| | | secondLength: 2500 |
| | | min: |
| | | one: #第一条磨边线的最小尺寸信息 |
| | | firstLength: 500 |
| | | secondLength: 400 |
| | | firstLength: 600 |
| | | secondLength: 350 |
| | | two: #第二条磨边线的最小尺寸信息 |
| | | firstLength: 400 |
| | | secondLength: 400 |
| | | secondLength: 300 |
| | | sequence: |
| | | order: false |
| | | |
| | |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailsWrapper = new LambdaQueryWrapper(); |
| | | bigStorageCageDetailsWrapper |
| | | .eq(BigStorageCageDetails::getSlot, slot) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL); |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN, Const.GLASS_STATE_ARTIFICIAL); |
| | | |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsMapper.selectList(bigStorageCageDetailsWrapper); |
| | | for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList |
| | | ) { |
| | | double widths = Math.max(bigStorageCageDetails.getWidth(),bigStorageCageDetails.getHeight()) ; |
| | | double widths = bigStorageCageDetails.getWidth(); |
| | | width = width - widths - glassGap; |
| | | } |
| | | //修改格子剩余宽度 |
| | |
| | | @Override |
| | | public List<Map<String, Object>> selectBigStorageCageUsage() { |
| | | QueryWrapper<BigStorageCage> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("device_id,ROUND(1 - SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) / COUNT(device_id), 2)*100 AS percentage,SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) AS count") |
| | | wrapper.select("device_id,ROUND(1 - SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) / COUNT(device_id), 2) AS percentage,SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) AS count") |
| | | |
| | | .groupBy("device_id"); |
| | | List<Map<String, Object>> bigStorageCageUsages = baseMapper.selectMaps(wrapper); |
| | |
| | | return baseMapper.queryFreeDeviceByUsed(thickness); |
| | | } |
| | | |
| | | // @Override |
| | | // public List<Integer> queryFreeDeviceByNotUsed(double thickness) { |
| | | // return baseMapper.queryFreeDeviceByNotUsed(thickness); |
| | | // } |
| | | @Override |
| | | public List<Integer> queryFreeDeviceByNotUsed(double thickness) { |
| | | return baseMapper.queryFreeDeviceByNotUsed(thickness); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | |
| | | if (!REQUEST_WORD.equals(mesD01Value) && REQUEST_WORD.equals(d01ToMES) && (StringUtils.isBlank(d02State) || !REQUEST_WORD.equals(d03State))) { |
| | | if (!d01GlassId.equals(d01Id)) { |
| | | judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD01Address); |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getStatus, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d01Id)); |
| | | d01GlassId = d01Id; |
| | | } |
| | | } |
| | |
| | | if (!REQUEST_WORD.equals(mesD04Value) && REQUEST_WORD.equals(d04ToMES) && !REQUEST_WORD.equals(d05State)) { |
| | | if (!d04GlassId.equals(d04Id)) { |
| | | judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION, mesD04Address); |
| | | edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() |
| | | .set(EdgGlassTaskInfo::getStatus, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d04Id)); |
| | | d04GlassId = d04Id; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | // //向plc写入确认字 |
| | | // int returnData = 0; |
| | | // int count = 1; |
| | | // while (returnData == 0) { |
| | | // log.info("已向plc第{}次送协议", count); |
| | | // S7object.getinstance().plccontrol.writeWord(mesToPLCAddress, 1); |
| | | // returnData = S7object.getinstance().plccontrol.readWord(mesToPLCAddress, 1).get(0); |
| | | // log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, mesToPLCAddress, returnData); |
| | | // } |
| | | //向plc写入确认字 |
| | | int returnData = 0; |
| | | int count = 1; |
| | | while (returnData == 0) { |
| | | log.info("已向plc第{}次送协议", count); |
| | | S7object.getinstance().plccontrol.writeWord(mesToPLCAddress, 1); |
| | | returnData = S7object.getinstance().plccontrol.readWord(mesToPLCAddress, 1).get(0); |
| | | log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, mesToPLCAddress, returnData); |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | log.info("大理片笼破损玻璃清除任务开始执行时间:{}", startDate); |
| | | //获取进片任务表中状态为破损的数据 |
| | | List<BigStorageCageFeedTask> inDamageTaskInfoList = bigStorageCageFeedTaskService.list(new LambdaQueryWrapper<BigStorageCageFeedTask>() |
| | | .in(BigStorageCageFeedTask::getTaskState, Const.GLASS_STATE_DAMAGE_TAKE)); |
| | | .eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_DAMAGE)); |
| | | if (CollectionUtils.isNotEmpty(inDamageTaskInfoList)) { |
| | | log.info("获取进片任务表中破损的玻璃信息{}", inDamageTaskInfoList); |
| | | bigStorageCageFeedTaskService.remove(new LambdaQueryWrapper<BigStorageCageFeedTask>().in(BigStorageCageFeedTask::getTaskState, Const.GLASS_STATE_DAMAGE_TAKE)); |
| | | bigStorageCageFeedTaskService.remove(new LambdaQueryWrapper<BigStorageCageFeedTask>().eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_DAMAGE)); |
| | | //理片笼详情表数据状态更新 |
| | | bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW).in(BigStorageCageDetails::getGlassId, inDamageTaskInfoList.stream().map(BigStorageCageFeedTask::getGlassId).collect(Collectors.toList()))); |
| | |
| | | damage.setLine(bigStorageCageFeedTask.getLine()); |
| | | damage.setWorkingProcedure("冷加工"); |
| | | damage.setRemark("进笼前卧转立"); |
| | | damage.setStatus(0); |
| | | damage.setType(bigStorageCageFeedTask.getTaskState()); |
| | | damage.setStatus(2); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(bigStorageCageFeedTask.getTargetSlot()); |
| | | } |
| | |
| | | } |
| | | //获取出片任务表中状态为破损的数据 |
| | | List<BigStorageCageOutTask> outDamageTaskInfoList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>() |
| | | .in(BigStorageCageOutTask::getTaskState, Const.GLASS_STATE_DAMAGE_TAKE)); |
| | | .eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_DAMAGE)); |
| | | if (CollectionUtils.isNotEmpty(outDamageTaskInfoList)) { |
| | | log.info("获取出片任务表中破损的玻璃信息{}", outDamageTaskInfoList); |
| | | bigStorageCageOutTaskService.remove(new LambdaQueryWrapper<BigStorageCageOutTask>().in(BigStorageCageOutTask::getTaskState, Const.GLASS_STATE_DAMAGE_TAKE)); |
| | | 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.setLine(bigStorageCageOutTask.getEndSlot()); |
| | | damage.setWorkingProcedure("冷加工"); |
| | | damage.setRemark("出片后卧转立"); |
| | | damage.setStatus(0); |
| | | damage.setType(bigStorageCageOutTask.getTaskState()); |
| | | damage.setStatus(2); |
| | | damageService.insertDamage(damage); |
| | | slotList.add(bigStorageCageOutTask.getStartSlot()); |
| | | } |
| | |
| | | */ |
| | | public Boolean judgeGlassTypeStatus(String glassId, Integer line, String mesAddress) { |
| | | //1、获取任务表中相邻玻璃 |
| | | List<EdgGlassTaskInfo> edgGlassTaskInfoList ; |
| | | edgGlassTaskInfoList= edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | List<EdgGlassTaskInfo> edgGlassTaskInfoList = edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | .eq(EdgGlassTaskInfo::getLine, line) |
| | | .apply("time >= (select time from edg_glass_task_info where line='" + line + "' and glass_id = '" + glassId + "' and deleted = 0)") |
| | | .apply("time >= (select time from edg_glass_task_info where glass_id = '" + glassId + "')") |
| | | .orderByAsc(EdgGlassTaskInfo::getTime)); |
| | | if(edgGlassTaskInfoList==null){ |
| | | log.info("线路:{}识别玻璃信息未出现在尺寸表中,获取相邻两块玻璃失败",line); |
| | | }else{ |
| | | edgGlassTaskInfoList= edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>() |
| | | .eq(EdgGlassTaskInfo::getGlassId, glassId) |
| | | .last("limit 1")); |
| | | log.info("在尺寸表中获取玻璃信息{}",edgGlassTaskInfoList); |
| | | } |
| | | Assert.isFalse(CollectionUtils.isEmpty(edgGlassTaskInfoList), "识别玻璃信息未出现在尺寸表中,获取相邻两块玻璃失败"); |
| | | //2、获取卧转立剩余宽度 |
| | | BigStorageDTO sitToUpRemainWidth = bigStorageCageFeedTaskService.querySitToUpRemainWidth(line); |
| | |
| | | while (returnData == 0) { |
| | | s7control.writeWord(outLine, 2); |
| | | returnData = s7control.readWord(outLine, 1).get(0); |
| | | log.info("已向plc第{}次发送进片任务确认,地址为:{},写入的内容为{}", count++, outLine, returnData); |
| | | log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, outLine, returnData); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | | // } |
| | | 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; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | |
| | | |
| | | @Autowired |
| | | private TemperingGlassInfoService temporaryGlassInfoService; |
| | | |
| | | @Autowired |
| | | private DamageService damageService; |
| | | |
| | | private static final String ALONE_STATE = "0"; |
| | | |
| | | |
| | |
| | | List<Object> temperRecordIdListObj = temporalRecordService.listObjs(new QueryWrapper<TemperingRecord>().select("distinct tempering_layout_id")); |
| | | |
| | | List<String> temperRecordIdList = temperRecordIdListObj.stream().map(String::valueOf).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(temperRecordIdList)) { |
| | | log.info("当前系统没有需要钢化的玻璃信息"); |
| | | return; |
| | | } |
| | | List<TemperingGlassInfo> list = temporaryGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_START).notIn(TemperingGlassInfo::getTemperingLayoutId, temperRecordIdList)); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingGlassAfter() { |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("钢化破损玻璃清除任务开始执行时间:{}", startDate); |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temporaryGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>().in(TemperingGlassInfo::getState, Const.GLASS_STATE_DAMAGE_TAKE)); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) { |
| | | //获取破损/拿走玻璃id |
| | | List<String> glassList = temperingGlassInfoList.stream().map(TemperingGlassInfo::getGlassId).collect(Collectors.toList()); |
| | | //将任务表中的数据删除 |
| | | temporaryGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().in(TemperingGlassInfo::getGlassId, glassList)); |
| | | List<Damage> damageList = temperingGlassInfoList.stream().map(e -> { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(e.getGlassId()); |
| | | damage.setLine(Const.TEMPERING_OUT_TARGET_POSITION); |
| | | damage.setWorkingProcedure("钢化"); |
| | | damage.setRemark("钢化"); |
| | | damage.setStatus(0); |
| | | damage.setType(e.getState()); |
| | | return damage; |
| | | }).collect(Collectors.toList()); |
| | | damageService.batchInsertDamage(damageList); |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | } |
| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.entity.request.DownGlassInfoRequest; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.job.DownLoadCacheGlassTask; |
| | | import com.mes.pp.service.FlowCardService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { |
| | | |
| | |
| | | |
| | | @Autowired |
| | | DownStorageCageDetailsService downStorageCageDetailsService; |
| | | |
| | | |
| | | @Autowired |
| | | DownWorkstationService downWorkstationService; |
| | | |
| | | @Autowired |
| | | RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | FlowCardService flowCardService; |
| | | |
| | | /** |
| | | * 根据流程卡号查询最大序号 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DownGlassInfoDTO> queryWorkStationIsIn(List<Integer> workList, Boolean isDownload) { |
| | | //按照要求获取已落架/未落架的玻璃信息 |
| | | return baseMapper.queryWorkStationIsIn(workList, isDownload); |
| | | } |
| | | |
| | | @Override |
| | | public List<DownGlassInfoDTO> queryWorkStationFlowCard(List<Integer> workList) { |
| | | //获取已绑定流程卡的架子未落玻璃的数据信息 |
| | | return baseMapper.queryWorkStationFlowCard(workList); |
| | | public List<DownGlassInfoDTO> queryWorkStationIsIn(Boolean isDownload) { |
| | | return baseMapper.queryWorkStationIsIn(isDownload); |
| | | } |
| | | |
| | | @Override |
| | |
| | | BeanUtils.copyProperties(details, downGlassInfo); |
| | | //获取当前流程卡最大片序 |
| | | downGlassInfo.setSequence(this.getMaxSequenceByFlowCardId(details.getFlowCardId(), details.getLayer()) + 1); |
| | | downGlassInfo.setWorkStationId(Const.G13_WORK_STATION); |
| | | this.save(downGlassInfo); |
| | | //生成任务信息 并向plc发送出片任务 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | | BeanUtils.copyProperties(details, glassInfo); |
| | | return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), Const.G13_WORK_STATION, 2); |
| | | } |
| | | |
| | | @Override |
| | | public String setDownGlassInfoRequest(DownGlassInfoRequest request) { |
| | | if (request == null) { |
| | | redisUtil.deleteObject("downGlassRequest"); |
| | | } else { |
| | | redisUtil.setCacheObject("downGlassRequest", request); |
| | | } |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public List<DownWorkstation> queryWorkStationIsFull() { |
| | | //查询可以落架的玻璃信息且已绑定流程卡的工位信息 |
| | | List<DownWorkstation> list = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getEnableState, Const.SLOT_ON) |
| | | .isNotNull(DownWorkstation::getFlowCardId).ne(DownWorkstation::getFlowCardId, "")); |
| | | List<DownWorkstation> workstationFull = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | //都有玻璃的工位信息(包括绑定流程卡) |
| | | List<Integer> workstationList = list.stream().map(DownWorkstation::getWorkstationId).collect(Collectors.toList()); |
| | | //按照符合条件的工位获取未落架的流程卡玻璃,如果返回为空,则表明所有都已落架完成 |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = queryWorkStationIsIn(workstationList, Boolean.FALSE); |
| | | //获取工位上的未满的流程卡及层数 |
| | | List<String> flowCardIdList = downGlassInfoDTOList.stream().map(item -> item.getFlowCardId() + ":" + item.getLayer()).collect(Collectors.toList()); |
| | | //可以落架的玻璃信息且已绑定流程卡的所有的工位 - 玻璃未满流程卡及层数的工位 = 已满工位 |
| | | workstationFull = list.stream().filter(item -> !flowCardIdList.contains(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | //是否需要将已满的工位置为不可落架 |
| | | if (CollectionUtils.isNotEmpty(workstationFull)) { |
| | | List<Integer> workstationIds = workstationFull.stream().map(DownWorkstation::getWorkstationId).collect(Collectors.toList()); |
| | | downWorkstationService.update(new LambdaUpdateWrapper<DownWorkstation>().set(DownWorkstation::getEnableState, Const.SLOT_OFF) |
| | | .in(DownWorkstation::getWorkstationId, workstationIds)); |
| | | } |
| | | } |
| | | return workstationFull; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, List<Map<String, Object>>>> downGlassPrint(DownGlassInfo downGlassInfo) { |
| | | log.info("打印参数:{}", downGlassInfo); |
| | | QueryWrapper<DownGlassInfo> queryWrapper = Wrappers.query(); |
| | | queryWrapper.eq("flow_card_id", downGlassInfo.getFlowCardId()) |
| | | .eq("layer", downGlassInfo.getLayer()) |
| | | .select("flow_card_id", "layer", "width", "height", "filmsid", "thickness", "glass_type", "COUNT(*) AS quantity") |
| | | .groupBy("flow_card_id", "layer", "width", "height", "filmsid", "thickness", "glass_type", "id") |
| | | .orderByAsc("id"); |
| | | List<Map<String, Object>> resultList = baseMapper.selectMaps(queryWrapper); |
| | | |
| | | log.info("MES落架数据:{}", resultList); |
| | | |
| | | List<Map<String, Object>> projectInfo = flowCardService.selectProject(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer()); |
| | | log.info("流程卡头部数据:{}", projectInfo); |
| | | List<Map<String, Object>> flowCardInfo = flowCardService.selectFlowCard(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer()); |
| | | log.info("流程卡玻璃数据:{}", flowCardInfo); |
| | | for (Map<String, Object> row : flowCardInfo) { |
| | | int order_number = (int) row.get("order_number"); |
| | | int technology_number = (int) row.get("technology_number"); |
| | | int quantity1 = 0; |
| | | for (Map<String, Object> row1 : resultList) { |
| | | int glass_type = (int) row1.get("glass_type"); |
| | | int layer = (int) row1.get("layer"); |
| | | // String child_width = (String) row1.get("child_width"); |
| | | // Long quantity = (Long) row1.get("quantity"); |
| | | // BigDecimal total_area = (BigDecimal) row1.get("total_area"); |
| | | // String separation = (String) row1.get("separation"); |
| | | // String perimeter = (String) row1.get("perimeter"); |
| | | // BigDecimal width = (BigDecimal) row1.get("width"); |
| | | // String other_columns = (String) row1.get("other_columns"); |
| | | // String remarks = (String) row1.get("remarks"); |
| | | // BigDecimal height = (BigDecimal) row1.get("height"); |
| | | if (order_number == glass_type && technology_number == layer) { |
| | | quantity1+=1; |
| | | // row.put("quantity", quantity); |
| | | // row.put("order_number", order_number); |
| | | // row.put("technology_number", technology_number); |
| | | // row.put("child_width", child_width); |
| | | // row.put("total_area", total_area); |
| | | // row.put("separation", separation); |
| | | // row.put("perimeter", perimeter); |
| | | // row.put("width", width); |
| | | // row.put("other_columns", other_columns); |
| | | // row.put("remarks", remarks); |
| | | // row.put("height", height); |
| | | } |
| | | } |
| | | row.put("quantity1", quantity1); |
| | | } |
| | | log.info("流程卡玻璃数据2:{}", flowCardInfo); |
| | | List<Map<String, List<Map<String, Object>>>> listMap = new ArrayList<>(); |
| | | Map<String, List<Map<String, Object>>> result = new HashMap<>(); |
| | | result.put("detail", projectInfo); |
| | | result.put("detailList", flowCardInfo); |
| | | for (Map<String, Object> row : projectInfo) { |
| | | String order_number = (String) row.get("process"); |
| | | String[] processes = order_number.split("->"); |
| | | List<Map<String, Object>> processList = new ArrayList<>(); |
| | | for (int i = 0; i < processes.length; i++) { |
| | | Map<String, Object> processMap = new JSONObject(); |
| | | processMap.put("process", processes[i]); |
| | | processMap.put("id", i); |
| | | processList.add(processMap); |
| | | } |
| | | result.put("processList", processList); |
| | | } |
| | | listMap.add(result); |
| | | return listMap; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> downGlassLabelPrint(DownGlassInfo downGlassInfo) { |
| | | //获取下片玻璃的顺序 |
| | | // QueryWrapper<DownGlassInfo> queryWrapper = Wrappers.query(); |
| | | // queryWrapper |
| | | // .eq("flow_card_id", downGlassInfo.getFlowCardId()) |
| | | // .eq("layer", downGlassInfo.getLayer()) |
| | | // .select("flow_card_id", "layer", "width", "height", "filmsid", "thickness", "glass_type", "COUNT(*) AS quantity") |
| | | // .groupBy("flow_card_id", "layer", "width", "height", "filmsid", "thickness", "glass_type", "id") |
| | | // .orderByAsc("id"); |
| | | // List<Map<String, Object>> resultList = baseMapper.selectMaps(queryWrapper); |
| | | List<Map<String, Object>> resultList = baseMapper.downGlassLabelPrint(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer()); |
| | | log.info("MES落架数据:{}", resultList); |
| | | //获取ERP标签所需的信息 |
| | | List<Map<String, Object>> labelInfo = flowCardService.selectLabel(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer()); |
| | | log.info("标签数据:{}", labelInfo); |
| | | |
| | | for (Map<String, Object> row : resultList) { |
| | | int glass_type = (int) row.get("glass_type"); |
| | | int layer = (int) row.get("layer"); |
| | | for (Map<String, Object> row1 : labelInfo) { |
| | | int orderNumber = (int) row1.get("orderNumber"); |
| | | int technologyNumber = (int) row1.get("technologyNumber"); |
| | | if (orderNumber == glass_type && technologyNumber == layer) { |
| | | |
| | | String order_id = (String) row1.get("order_id"); |
| | | String project = (String) row1.get("project"); |
| | | Long customer_id = (Long) row1.get("customer_id"); |
| | | BigDecimal width = (BigDecimal) row1.get("width"); |
| | | BigDecimal height = (BigDecimal) row1.get("height"); |
| | | Long quantity = (Long) row1.get("quantity"); |
| | | String glass_child = (String) row1.get("glass_child"); |
| | | String process = (String) row1.get("process"); |
| | | String customer_name = (String) row1.get("customer_name"); |
| | | String processing_note = (String) row1.get("processing_note"); |
| | | String other_colunmns = (String) row1.get("other_colunmns"); |
| | | String building_number = (String) row1.get("building_number"); |
| | | String bend_radius = (String) row1.get("bend_radius"); |
| | | |
| | | row.put("orderNumber", orderNumber); |
| | | row.put("technology_number", technologyNumber); |
| | | row.put("order_id", order_id); |
| | | row.put("project", project); |
| | | row.put("customer_id", customer_id); |
| | | row.put("width", width); |
| | | row.put("height", height); |
| | | row.put("quantity", quantity); |
| | | row.put("glass_child", glass_child); |
| | | row.put("process", process); |
| | | row.put("customer_name", customer_name); |
| | | row.put("processing_note", processing_note); |
| | | row.put("other_colunmns", other_colunmns); |
| | | row.put("building_number", building_number); |
| | | row.put("bend_radius", bend_radius); |
| | | } |
| | | } |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.entity.request.CacheWornRequest; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | |
| | | private DownStorageCageDetailsService downStorageCageDetailsService; |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | | @Autowired |
| | | DamageService damageService; |
| | | |
| | | @Override |
| | | public DownGlassTask createDownGlassTask(GlassInfo glassInfo, Integer startCell, Integer endCell, Integer taskType) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectDownStorageCages() { |
| | | return baseMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCage.class) |
| | |
| | | |
| | | if (downItem != null) { |
| | | //移除 |
| | | DownStorageCageDetails result = downStorageCageDetailsMapper |
| | | .selectOne(new MPJLambdaWrapper<DownStorageCageDetails>() |
| | | .eq(DownStorageCageDetails::getSlot, downStorageCageId) |
| | | ); |
| | | DownStorageCageDetails result = downStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<DownStorageCageDetails>().eq(DownStorageCageDetails::getSlot, downStorageCageId)); |
| | | if (result != null) { |
| | | result.setSlot(0); |
| | | downStorageCageDetailsMapper.updateById(result); |
| | |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteDownStorageCage(CacheWornRequest cacheWornRequest) { |
| | | Damage damage = new Damage(); |
| | | BeanUtils.copyProperties(cacheWornRequest, damage); |
| | | damage.setType(cacheWornRequest.getState()); |
| | | damage.setRemark(""); |
| | | damage.setStatus(0); |
| | | damageService.insertDamage(damage); |
| | | downStorageCageDetailsService.update(new LambdaUpdateWrapper<DownStorageCageDetails>() |
| | | .set(DownStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .eq(DownStorageCageDetails::getGlassId, cacheWornRequest.getGlassId()) |
| | | .eq(DownStorageCageDetails::getState,Const.GLASS_STATE_IN)); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.entity.DownWorkstionAndDownGlassinfo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | @Autowired(required = false) |
| | | private DownWorkstationTaskMapper downWorkstationTaskMapper; |
| | | @Autowired |
| | | private DownGlassInfoService downGlassInfoService; |
| | | @Autowired |
| | | private DownGlassInfoMapper downGlassInfoMapper; |
| | | @Autowired |
| | | private DownGlassTaskService downGlassTaskService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private DownWorkstationTaskService downWorkstationTaskService; |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | // @Override |
| | | // public List<DownWorkstation> gettwoDownWorkstations() { |
| | |
| | | @Override |
| | | public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(int start, int end) { |
| | | MPJQueryWrapper<DownWorkstation> queryWrapper = new MPJQueryWrapper<>(); |
| | | queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight,total_quantity,racks_number,other_number") |
| | | queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight") |
| | | .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id") |
| | | .groupBy("t.workstation_id", "t.flow_card_id") |
| | | .orderByAsc("t.workstation_id").between("t.workstation_id", start, end) |
| | |
| | | item.put("width", downWorkstionAndDownGlassinfo.getTotalwidth()); |
| | | item.put("fillColor", "yellow"); |
| | | item.put("content", downWorkstionAndDownGlassinfo.getFlowCardId()); |
| | | if (downWorkstionAndDownGlassinfo.getFlowCardId() != "" && downWorkstionAndDownGlassinfo.getFlowCardId() != null && downWorkstionAndDownGlassinfo.getTotalQuantity() == downWorkstionAndDownGlassinfo.getRacksNumber() + downWorkstionAndDownGlassinfo.getRacksNumber()) { |
| | | item.put("fullCardColor", "red"); |
| | | } else { |
| | | item.put("fullCardColor", "blue"); |
| | | } |
| | | |
| | | // 查询 DownGlassInfo 并添加到 item 中 |
| | | MPJQueryWrapper<DownGlassInfo> glassInfoQueryWrapper = new MPJQueryWrapper<>(); |
| | |
| | | updateWrapper.set("flow_card_id", null) |
| | | .set("total_quantity", 0) |
| | | .set("racks_number", 0) |
| | | .set("other_number", 0) |
| | | .set("layer", null) |
| | | .eq("workstation_id", workstationId); |
| | | |
| | | baseMapper.update(new DownWorkstation(), updateWrapper); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String closeAlarmSignal() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("alarm_signal").getAddress(), 0); |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public void autoPrint(Boolean flag) { |
| | | redisUtil.setCacheObject("autoPrint", flag); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.lang.Assert; |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | |
| | | DownWorkstationService downWorkstationService; |
| | | @Autowired |
| | | DownGlassInfoService downGlassInfoService; |
| | | @Autowired |
| | | DamageService damageService; |
| | | |
| | | @Value("${mes.threshold}") |
| | | private Integer threshold; |
| | | |
| | | @Value("${mes.throughWidth}") |
| | | private Integer throughWidth; |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcShelfFull() { |
| | | List<DownWorkstation> list = downGlassInfoService.queryWorkStationIsFull(); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | S7control s7control = S7object.getinstance().plccontrol; |
| | | PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject; |
| | | s7control.writeWord(plcMesObject.getPlcParameter("alarm_signal").getAddress(), 1); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("下片破损玻璃清除任务开始执行时间:{}", startDate); |
| | | List<DownGlassTask> downGlassTaskList = downGlassTaskService.list(new LambdaQueryWrapper<DownGlassTask>() |
| | | .in(DownGlassTask::getTaskType, Const.GLASS_CACHE_TYPE_OUT_ALL).in(DownGlassTask::getTaskStatus, Const.GLASS_STATE_DAMAGE_TAKE)); |
| | | if (CollectionUtils.isNotEmpty(downGlassTaskList)) { |
| | | //获取破损/拿走玻璃id |
| | | List<String> glassList = downGlassTaskList.stream().map(DownGlassTask::getGlassId).collect(Collectors.toList()); |
| | | //将任务表中的数据删除 |
| | | downGlassTaskService.remove(new LambdaQueryWrapper<DownGlassTask>().in(DownGlassTask::getTaskType, Const.GLASS_CACHE_TYPE_OUT_ALL).in(DownGlassTask::getGlassId, glassList)); |
| | | List<Damage> damageList = downGlassTaskList.stream().map(e -> { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(e.getGlassId()); |
| | | damage.setLine(Const.TEMPERING_OUT_TARGET_POSITION); |
| | | damage.setWorkingProcedure("下片"); |
| | | damage.setRemark("下片"); |
| | | damage.setStatus(0); |
| | | damage.setType(e.getTaskStatus()); |
| | | return damage; |
| | | }).collect(Collectors.toList()); |
| | | damageService.batchInsertDamage(damageList); |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 更新已绑定工位流程卡的破损/拿走的数量信息 |
| | | */ |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void updateWorkStationOtherCount() { |
| | | Date startDate = new Date(); |
| | | log.info("下片破更新损玻璃数量任务开始执行时间:{}", startDate); |
| | | //获取已绑定流程卡的工位信息 |
| | | List<DownWorkstation> downWorkstationList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNotNull(DownWorkstation::getFlowCardId) |
| | | .ne(DownWorkstation::getFlowCardId, "") |
| | | .orderByDesc(DownWorkstation::getWorkstationId)); |
| | | for (DownWorkstation downWorkstation : downWorkstationList) { |
| | | //更新工位其他玻璃信息的数量 |
| | | QueryWrapper<Damage> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("process_id", downWorkstation.getFlowCardId()); |
| | | queryWrapper.eq("technology_number", downWorkstation.getLayer()); |
| | | int otherNumber = damageService.count(queryWrapper); |
| | | downWorkstationService.update(new LambdaUpdateWrapper<DownWorkstation>().set(DownWorkstation::getOtherNumber, otherNumber) |
| | | .eq(DownWorkstation::getWorkstationId, downWorkstation.getWorkstationId())); |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("下片破更新损玻璃数量任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | public void inTo(String glassId, String requestWord, String currentSlot) { |
| | | log.info("1、按照玻璃id:{}获取玻璃小片信息,当前格子为:{}", glassId, currentSlot); |
| | | //添加进片任务 查找空格 |
| | |
| | | } |
| | | if (!checkFlag) { |
| | | log.info("无空架子,获取已绑定架子的流程卡信息,查看玻璃信息是否可被对调"); |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = downGlassInfoService.queryWorkStationIsIn(Const.WORK_STATION_ALL, Boolean.FALSE); |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = downGlassInfoService.queryWorkStationIsIn(Boolean.FALSE); |
| | | log.info("获取架子上已绑定流程卡落架的数量及未落架的玻璃数据:{}", downGlassInfoDTOList); |
| | | if (CollectionUtils.isEmpty(downGlassInfoDTOList)) { |
| | | log.info("已绑定流程卡均无未落架玻璃,请及时处理架子上的玻璃,清除流程卡,执行进片任务"); |
| | |
| | | BeanUtils.copyProperties(glassInfo, downStorageCageDetails); |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_IN); |
| | | downStorageCageDetails.setSlot(nearestEmpty.getSlot()); |
| | | downStorageCageDetails.setDeviceId(nearestEmpty.getDeviceId()); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | // 生成进片任务 |
| | | initDownGlassTask(glassInfo, 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | |
| | | //获取当前笼子空格信息 |
| | | DownStorageCage empty = downStorageCageService.selectCacheEmpty(Integer.parseInt(currentSlot), Boolean.TRUE); |
| | | cageDetails.setSlot(empty.getSlot()); |
| | | cageDetails.setDeviceId(empty.getDeviceId()); |
| | | tempList.add(cageDetails); |
| | | } |
| | | log.info("出片2:笼内玻璃的数据(包括待进片)有:{}", tempList); |
| | |
| | | } |
| | | } |
| | | 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:无 |
| | |
| | | .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()); |
| | | if (CollectionUtils.isEmpty(list) && 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 { |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃,且未绑定架子的玻璃信息(都可以出的玻璃)"); |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃,且未绑定架子的玻璃信息"); |
| | | //获取禁用及非本机械臂的架子的流程号及层数对应的玻璃信息 |
| | | List<DownWorkstation> downWorkstationOffList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .and(i -> i.in(DownWorkstation::getWorkstationId, offWorkStationList).or().eq(DownWorkstation::getEnableState, Const.SLOT_OFF))); |
| | |
| | | log.info("笼内玻璃无法执行出片"); |
| | | return Boolean.FALSE; |
| | | } |
| | | //获取具体出那一片玻璃 |
| | | //tao:人工--> 所有架子都未绑定时进行绑定 --->有未绑定架子时进行绑定 --->绑定过流程卡的玻璃-->玻璃流程卡多层--->玻璃流程卡单层 |
| | | String tempGlassId = null; |
| | | Boolean isNeedBind = Boolean.FALSE; |
| | | |
| | |
| | | loop: |
| | | if (StringUtils.isBlank(tempGlassId)) { |
| | | //获取正在落架的绑定流程卡的信息(流程卡、层数、落架数量) |
| | | //落架玻璃数为0,即使绑定了流程卡,也无法找到对应的架子信息,只能重新绑定 |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = downGlassInfoService.queryWorkStationFlowCard(workList); |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = downGlassInfoService.queryWorkStationIsIn(Boolean.TRUE); |
| | | List<String> downGlassFlowList = downGlassInfoDTOList.stream().map(item -> item.getFlowCardId() + ":" + item.getLayer()).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(downGlassFlowList)) { |
| | | //架子都未绑定流程卡,出笼内子数量最多尺寸最大的玻璃id,无 则返回扫描扫到的玻璃id进行出片 |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId, offWorkStationList); |
| | | |
| | | isNeedBind = Boolean.TRUE; |
| | | break loop; |
| | | } |
| | | //将笼子内的玻璃进行过滤,仅获取无法落架的流程卡玻璃 |
| | | //tao:当有空架时优先对笼内可出片且未绑架子的玻璃进出绑架并出片 |
| | | List<DownStorageCageDetails> noDownLoadList = list.stream().filter(item -> !downGlassFlowList.contains(item.getFlowCardId() + ":" + item.getLayer())) |
| | | .collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(noDownLoadList)) { |
| | |
| | | return Boolean.FALSE; |
| | | } |
| | | //将笼内玻璃的流程卡+层号 和落架的流程卡 去重,得出展示无法落架的玻璃,判断玻璃数是否超过阈值 |
| | | //笼内玻璃是否可落架:笼内是否有需要中空 |
| | | //笼内玻璃是否可落架:笼内是否有需要中空的 |
| | | List<DownStorageCageDetails> multiLayerList = list.stream().filter(item -> item.getTotalLayer() >= 2).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(multiLayerList)) { |
| | | for (DownStorageCageDetails item : multiLayerList) { |
| | |
| | | break loop; |
| | | } |
| | | Integer sequence = downGlassInfoService.queryMaxSequence(item.getFlowCardId(), item.getLayer()); |
| | | log.info("获取当前玻璃需要放的次序:笼内同流程 同层数的落架次序+1:{}", sequence); |
| | | log.info("获取当前玻璃需要放的次序:笼内同流程 同层数的通达次序+1:{}", sequence); |
| | | DownGlassInfo downGlassInfo = downGlassInfoService.getOne(new LambdaQueryWrapper<DownGlassInfo>() |
| | | .eq(DownGlassInfo::getFlowCardId, downGlassInfoDTO.getFlowCardId()) |
| | | .eq(DownGlassInfo::getLayer, downGlassInfoDTO.getLayer()).eq(DownGlassInfo::getSequence, sequence)); |
| | |
| | | if (CollectionUtils.isNotEmpty(downStorageCageDetails)) { |
| | | tempGlassId = downStorageCageDetails.get(0).getGlassId(); |
| | | break; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | //落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfo.setWorkStationId(endCell); |
| | | downGlassInfo.setGmtCreate(new Date()); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | |
| | |
|
| | | import cn.hutool.json.JSONObject;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | import com.mes.common.config.Const;
|
| | | import com.mes.common.utils.RedisUtil;
|
| | | import com.mes.downglassinfo.entity.DownGlassInfo;
|
| | | import com.mes.downglassinfo.entity.DownGlassTask;
|
| | | import com.mes.downglassinfo.entity.request.DownGlassInfoRequest;
|
| | | import com.mes.downglassinfo.service.DownGlassInfoService;
|
| | | import com.mes.downglassinfo.service.DownGlassTaskService;
|
| | | import com.mes.downstorage.service.DownStorageCageService;
|
| | | import com.mes.downworkstation.entity.DownWorkstation;
|
| | | import com.mes.downworkstation.service.DownWorkstationService;
|
| | | import com.mes.tools.DateUtil;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.apache.commons.lang.StringUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
| | | private DownStorageCageService downStorageCageService;
|
| | | @Autowired
|
| | | private DownGlassInfoService downGlassInfoService;
|
| | | @Autowired
|
| | | private DownGlassTaskService downGlassTaskService;
|
| | |
|
| | |
|
| | | @Autowired
|
| | | private RedisUtil redisUtil;
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownWorkstations() {
|
| | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
|
| | | if (sendwServer != null) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | log.info("已发送");
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | }
|
| | |
| | | public void sendGlassInfoData() {
|
| | | log.info("发送工位显示图信息1");
|
| | | JSONObject jsonObject2 = new JSONObject();
|
| | | List<Map<String, Object>> glassinfodata = downWorkstationService.getTotalGlassDimensionsByWorkstation(1, 3);
|
| | | jsonObject2.append("glassinfo", glassinfodata);
|
| | | List<Map<String, Object>> glassinfodata = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
|
| | | jsonObject2.append("glassinfo",glassinfodata);
|
| | | log.info(jsonObject2.toString());
|
| | | ArrayList<WebSocketServer> sendwServer2 = WebSocketServer.sessionMap.get("unloadglass2");
|
| | | if (sendwServer2 != null) {
|
| | | for (WebSocketServer webserver : sendwServer2) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject2.toString());
|
| | | }
|
| | | }
|
| | |
| | | public void sendGlassInfoData2() {
|
| | | log.info("发送工位显示图信息2");
|
| | | JSONObject jsonObject3 = new JSONObject();
|
| | | List<Map<String, Object>> glassinfodata2 = downWorkstationService.getTotalGlassDimensionsByWorkstation(4, 6);
|
| | | jsonObject3.append("glassinfo2", glassinfodata2);
|
| | | List<Map<String, Object>> glassinfodata2 = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
|
| | | jsonObject3.append("glassinfo2",glassinfodata2);
|
| | | log.info(jsonObject3.toString());
|
| | | ArrayList<WebSocketServer> sendwServer3 = WebSocketServer.sessionMap.get("unloadglass3");
|
| | | if (sendwServer3 != null) {
|
| | | for (WebSocketServer webserver : sendwServer3) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject3.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownStorageCages() {
|
| | | log.info("发送缓存玻璃信息");
|
| | | JSONObject jsonObject4 = new JSONObject();
|
| | | List<Map<String, Object>> list = downStorageCageService.selectDownStorageCages();
|
| | | jsonObject4.append("params2", list);
|
| | | log.info(jsonObject4.toString());
|
| | | ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("downcache");
|
| | | if (sendwServer4 != null) {
|
| | | for (WebSocketServer webserver : sendwServer4) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject4.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | List<Map<String, Object>> list=downStorageCageService.selectDownStorageCages();
|
| | | jsonObject4.append("params2",list);
|
| | | log.info(jsonObject4.toString());
|
| | | ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("downcache");
|
| | | if (sendwServer4 != null) {
|
| | | for (WebSocketServer webserver : sendwServer4) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject4.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownGlassInfo() {
|
| | | DownGlassInfoRequest request = redisUtil.getCacheObject("downGlassRequest");
|
| | | if (null == request) {
|
| | | request = new DownGlassInfoRequest();
|
| | | }
|
| | | if (request.getBeginDate() == null) {
|
| | | request.setBeginDate(DateUtil.getBeginDate());
|
| | | request.setEndDate(DateUtil.getEndDate());
|
| | | }
|
| | | log.info("发送当前正在执行工程已落架的玻璃信息");
|
| | | LambdaQueryWrapper<DownGlassInfo> wrapper = new LambdaQueryWrapper<DownGlassInfo>()
|
| | | .between(null != request.getBeginDate(), DownGlassInfo::getGmtCreate, request.getBeginDate(), request.getEndDate())
|
| | | .eq(StringUtils.isNotBlank(request.getEngineerId()), DownGlassInfo::getEngineerId, request.getEngineerId());
|
| | | if (null == request.getWorkStationId() || 0 == request.getWorkStationId()) {
|
| | | wrapper.in(DownGlassInfo::getWorkStationId, Const.WORK_STATION_ALL);
|
| | | } else {
|
| | | wrapper.eq(DownGlassInfo::getWorkStationId, request.getWorkStationId());
|
| | | }
|
| | | List<DownGlassInfo> downGlassInfos = downGlassInfoService.list(wrapper);
|
| | | // Map<Integer, List<DownGlassInfo>> listMap = downGlassInfos.stream().collect(Collectors.groupingBy(DownGlassInfo::getWorkStationId));
|
| | | List<Object> engineerIdListTemp = downGlassInfoService.listObjs(new QueryWrapper<DownGlassInfo>().select("distinct engineer_id"));
|
| | | List<String> engineerIdList = engineerIdListTemp.stream().map(String::valueOf).collect(Collectors.toList());
|
| | | 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();
|
| | | jsonObject4.append("downGlassInfos", downGlassInfos);
|
| | | jsonObject4.append("engineerIdList", engineerIdList);
|
| | |
|
| | | //钢化开关
|
| | | boolean autoPrint = false;
|
| | | if (redisUtil.getCacheObject("autoPrint") == null) {
|
| | | redisUtil.setCacheObject("autoPrint", false);
|
| | | } else {
|
| | | autoPrint = redisUtil.getCacheObject("autoPrint");
|
| | | }
|
| | | jsonObject4.append("autoPrint", autoPrint);
|
| | |
|
| | | ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("unloadglass");
|
| | | 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());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 1000)
|
| | | public void isRun() {
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | //正在进行的任务
|
| | | List<DownWorkstation> downWorkstation = downWorkstationService.getoneDownWorkstations(1, 6);
|
| | | jsonObject.append("downWorkstation", downWorkstation);
|
| | | List<DownGlassTask> downGlassTask = downGlassTaskService.selectOutTaskCache();
|
| | | jsonObject.append("downGlassTask", downGlassTask);
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unLoadGlassIsRun");
|
| | | if (sendwServer != null) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | | if (webserver != null) {
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | } else {
|
| | | log.info("unLoadGlassIsRun is closed");
|
| | | }
|
| | | }
|
| | | }
|