| | |
| | | package com.mes.workstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | //import com.mes.common.S7object; |
| | | import com.mes.glassinfo.entity.UpPattenUsage; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import com.mes.workstation.entity.UpWorkSequence; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import com.mes.workstation.mapper.UpWorkstationMapper; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class UpWorkstationServiceImpl extends ServiceImpl<UpWorkstationMapper, UpWorkstation> implements UpWorkstationService { |
| | | |
| | | public class UpWorkstationServiceImpl extends ServiceImpl<UpWorkstationMapper, UpWorkstation> implements UpWorkstationService { |
| | | @Resource |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | public static final String DB_100_10 = "DB_100_10"; |
| | | |
| | | //判断是否可以吸片进行任务 |
| | | public boolean isCanLoadGlass() { |
| | | String loadstart="吸片信号";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | String loadstart = "吸片信号";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | return "1".equals(loadstart); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | //判断优先吸片位置后发送出片任务 |
| | | public void selectPriority() { |
| | | //todo:判断是否可以吸片进行任务 |
| | | // String loadstart="吸片信号";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | // if (!"1".equals(loadstart)) { |
| | | // return; |
| | | // } |
| | | UpWorkSequence loadid1 = this.baseMapper.selectPriority(1).get(0); |
| | | UpWorkSequence loadid2 = this.baseMapper.selectPriority(2).get(0); |
| | | //判断一二号工位哪边的顺序更先 |
| | | // if(loadid1.getSequence()>loadid2.getSequence()) { |
| | | // S7object.getinstance().plccontrol.WriteWord(DB_100_10, (short)2); |
| | | // }else if(loadid1.getSequence()==loadid2.getSequence()){ |
| | | // //当两个工位上的玻璃数相同时,判断哪个工位上的玻璃数更少,优先清空一个架子 |
| | | // int glassnum1=loadid1.getNumber();//Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | // int glassnum2=loadid2.getNumber();//Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | // if(glassnum1>glassnum2){ |
| | | // S7object.getinstance().plccontrol.WriteWord(DB_100_10, (short)2); |
| | | // }else{ |
| | | // S7object.getinstance().plccontrol.WriteWord(DB_100_10, (short)1); |
| | | // } |
| | | // }else{ |
| | | // S7object.getinstance().plccontrol.WriteWord(DB_100_10, (short)1); |
| | | // } |
| | | |
| | | public UpWorkSequence selectPriority() { |
| | | UpWorkSequence upwork= this.baseMapper.selectPriority(1); |
| | | String start = "1";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | UpPattenUsage uplist=new UpPattenUsage(); |
| | | if(start.equals("1")){ |
| | | //发送出片任务 |
| | | UpdateWrapper<UpPattenUsage> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("state",1).last("LIMIT 1"); |
| | | uplist= upPattenUsageMapper.selectOne(updateWrapper); |
| | | log.info("查询出本次出片的玻璃信息[]",uplist); |
| | | } |
| | | return upwork; |
| | | } |
| | | |
| | | /** |
| | |
| | | int update = this.baseMapper.update(upwork, updateWrapper); |
| | | } |
| | | |
| | | |
| | | } |