Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | |
| | | @ApiOperation("开始/暂停任务/传递工程号和状态,开始是1 暂停是0") |
| | | @PostMapping("/changeTask") //调用上片任务 |
| | | @ResponseBody |
| | | public Result <Engineering> changeTask(String projectId , Integer state) { |
| | | boolean work=engineeringService.changeTask(projectId,state); |
| | | log.info("开始任务返回:{}", work); |
| | | return Result.build(200, "",null); |
| | | public Result <Boolean> changeTask(@RequestBody Engineering engineering) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | log.info("StartorStop:{},{}", work,engineering); |
| | | return Result.build(200, engineering.getEngineerId(),work); |
| | | } |
| | | |
| | | @ApiOperation("查询可以上片的工程号") |
| | | @GetMapping("/selectTask") //调用上片任务 |
| | | @ResponseBody |
| | | public Result <List<Engineering>> selectTask() { |
| | | List<Engineering> engineering=engineeringService.selectTask(); |
| | | log.info("可领取任务返回:{}", engineering); |
| | | return Result.build(200, "",engineering); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return Engineering |
| | | */ |
| | | Engineering selectInitiate(Integer state); |
| | | |
| | | List<Engineering> selectTask(); |
| | | } |
| | |
| | | |
| | | @Autowired |
| | | OptimizeProjectMapper optimizeProjectMapper; |
| | | @Autowired |
| | | private EngineeringMapper engineeringMapper; |
| | | |
| | | //开始/暂停任务 |
| | | @Override |
| | | public boolean changeTask(String projectId, Integer state) { |
| | |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Engineering> selectTask() { |
| | | //查询可开始任务的工程 |
| | | QueryWrapper<Engineering> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state", 0); |
| | | return engineeringMapper.selectList(wrapper); |
| | | } |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @ApiOperation("显示工程选择信息") |
| | | @PostMapping("/listByState") //显示工程选择信息 |
| | | @ResponseBody |
| | | public Result<List<OptimizeProject>> listByState(@RequestBody OptimizeRequest optimizeRequest) { |
| | | log.info("将请求参数封装在请求类里面"); |
| | | List<OptimizeProject> glass = optimizeProjectService.listByState(optimizeRequest); |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @ApiOperation("显示正在出片的工程信息") |
| | | @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<List<UpPattenUsage>> prioritylist() { |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(1); |
| | | log.info("显示工位上的玻璃信息:{}", glass); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | log.info("显示正在出片的工程信息:{}", glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @ApiOperation("点击选择工程保存后进行调用,传入工程号") |
| | | @GetMapping("/saveUpPattenUsage") //查询现在上片机的玻璃信息 |
| | | public Result<Integer> saveUpPattenUsage(String engineeringId) { |
| | | log.info("传入工程号判断是否已保存:{}", engineeringId); |
| | | UpPattenUsage upPattenUsage= upPattenUsageService.selectedEngineering(engineeringId); |
| | | @PostMapping("/saveUpPattenUsage") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<Engineering> saveUpPattenUsage(@RequestBody Engineering engineering) { |
| | | log.info("engineeringId:{}", engineering); |
| | | UpPattenUsage upPattenUsage= upPattenUsageService.selectedEngineering(engineering.getEngineerId()); |
| | | if (upPattenUsage!=null){ |
| | | log.info("已保存过"); |
| | | return Result.build(200, "已保存的工程", 200); |
| | | return Result.build(200, "已保存的工程", null); |
| | | }else { |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineeringId); |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineering.getEngineerId()); |
| | | log.info("将查询出的UpPattenUsage数据保存到数据库表里"); |
| | | upPattenUsageService.saveUpPattenUsage(upPattenUsages); |
| | | log.info("从PP表查询glassinfo的数据并保存到表里"); |
| | | List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineeringId); |
| | | List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineering.getEngineerId()); |
| | | glassInfoService.saveGlassInfo(glassinfo); |
| | | log.info("从PP表查询engineering的数据并保存到表里"); |
| | | List<Engineering> engineering= engineeringService.selectEngineering(engineeringId); |
| | | engineeringService.saveEngineering(engineering); |
| | | List<Engineering> listengineering= engineeringService.selectEngineering(engineering.getEngineerId()); |
| | | engineeringService.saveEngineering(listengineering); |
| | | log.info("更改pp表状态为已领取"); |
| | | optimizeProjectService.changeTask(engineeringId, 200); |
| | | return Result.build(200, "", 200); |
| | | optimizeProjectService.changeTask(engineering.getEngineerId(), 200); |
| | | // List<UpPattenUsage> data=upPattenUsageService.prioritylist(); |
| | | // log.info("显示保存后的上片顺序表"); |
| | | return Result.build(200, "", engineering); |
| | | } |
| | | |
| | | } |
| | |
| | | * 查询工位上的玻璃信息 |
| | | * @return List<UpPattenUsage> |
| | | */ |
| | | List<UpPattenUsage> prioritylist(int state); |
| | | List<UpPattenUsage> prioritylist(); |
| | | /** |
| | | * 查询上片顺序信息 |
| | | * @return List<UpPattenUsage> |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; |
| | |
| | | |
| | | @Autowired |
| | | OptimizeProjectMapper optimizeProjectMapper; |
| | | @Autowired |
| | | EngineeringService engineeringService; |
| | | @Override |
| | | public List<UpPattenUsage> prioritylist(int state) { |
| | | log.info("将参数传入到查询类里,工程号做非空判断模糊查询"); |
| | | LambdaQueryWrapper<UpPattenUsage> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(UpPattenUsage::getState,state); |
| | | log.info("返回工程信息"); |
| | | return this.list(wrapper); |
| | | public List<UpPattenUsage> prioritylist() { |
| | | //获取正在上片的任务id |
| | | Engineering engineering= engineeringService.selectInitiate(1); |
| | | log.info("将参数传入到查询类里{}",engineering); |
| | | if(engineering!=null){ |
| | | LambdaQueryWrapper<UpPattenUsage> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(UpPattenUsage::getEngineeringId,engineering.getEngineerId()); |
| | | return this.list(wrapper); |
| | | }else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | try { |
| | | //获取是否有上片请求 |
| | | String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue(); |
| | | String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | //判断开始上片的工程号 |
| | | Engineering engineering = engineeringService.selectInitiate(1); |
| | | if ("1".equals(loadRequest) && engineering != null) { |
| | |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId); |
| | | |
| | | } |
| | | }else { |
| | | } |
| | | if("1".equals(mesToPlc)&& "0".equals(loadRequest)){ |
| | | //请求字为零时,任务字清零 |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0); |
| | | } |
| | |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | | if (loadStatus != null) { |
| | | log.info(loadStatus); |
| | | if ("1".equals(loadStatus)) { |
| | | log.info("收到汇报任务完成"); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | } else if ("2".equals(loadStatus)) { |
| | | log.info("收到汇报未完成任务"); |
| | | //减少工位数量,恢复任务状态 |
| | | overTask(loadStatus,0); |
| | | } else if ("3".equals(loadStatus)) { |
| | | log.info("收到汇报玻璃破损"); |
| | | overTask(loadStatus,0); |
| | | } else if("0".equals(loadStatus)){ |
| | | log.info("收到汇报清0状态"); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus,100); |
| | | switch (loadStatus) { |
| | | case "1": |
| | | log.info("收到汇报任务完成"); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | break; |
| | | case "2": |
| | | log.info("收到汇报未完成任务"); |
| | | //减少工位数量,恢复任务状态 |
| | | overTask(loadStatus, 0); |
| | | break; |
| | | case "3": |
| | | log.info("收到汇报玻璃破损"); |
| | | overTask(loadStatus, 0); |
| | | break; |
| | | case "0": |
| | | log.info("收到汇报清0状态"); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus, 100); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | private UpWorkstationService upWorkstationService; |
| | | @ApiOperation("显示工位上的玻璃信息") |
| | | @GetMapping("/list") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<List<UpWorkstation>> list() { |
| | | List<UpWorkstation> glass = upWorkstationService.list(); |
| | | log.info("显示工位上的玻璃信息:{}", glass); |
| | |
| | | @Test |
| | | public void textengineering2(){ |
| | | //更新工程表状态为已领取 |
| | | optimizeProjectService.changeTask("P24050801",200); |
| | | //optimizeProjectService.changeTask("P24050801",200); |
| | | engineeringService.changeTask("P24051102",1); |
| | | } |
| | | @Test |
| | | public void textengineering3(){ |
| | |
| | | UpPattenUsage upPattenUsage=upPattenUsageService.selectOverTask(); |
| | | log.info("上片表任务中的数据{}",upPattenUsage); |
| | | } |
| | | @Test |
| | | public void textengineering4(){ |
| | | //判断是否已保存过工程号到上片表 |
| | | List<Engineering> engineerings=engineeringService.selectTask(); |
| | | log.info("上片表任务中的数据{}",engineerings); |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public List<DownGlassTask> getUnloadingTaskState() { |
| | | QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_stauts", 0); |
| | | queryWrapper.eq("task_stauts", 0).eq("task_type", 2).or().eq("task_stauts", 3); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | |
| | | List<DownStorageCageDetails> CacheOut1(int start, int end); |
| | | |
| | | |
| | | /** |
| | | * @return 直通查询 |
| | | */ |
| | | List<GlassInfo> DirectConnection(); |
| | | } |
| | |
| | | // |
| | | // } |
| | | |
| | | @Override |
| | | public List<GlassInfo> DirectConnection(){ |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper2 = Wrappers.lambdaQuery(); |
| | | queryWrapper2.select(GlassInfo::getFlowCardId, |
| | | GlassInfo::getGlassId, |
| | | GlassInfo::getTemperingLayoutId, |
| | | GlassInfo::getTemperingFeedSequence) |
| | | .notInSql(GlassInfo::getGlassId, "SELECT glass_id FROM down_glass_info") |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence) |
| | | .last("LIMIT 1"); |
| | | |
| | | // 查询 GlassInfo 表 |
| | | log.info("直通查询"); |
| | | return glassInfoMapper.selectList(queryWrapper2); |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> CacheOut1(int start, int end) { |
| | |
| | | } |
| | | log.info("2、获取到的玻璃信息为{}", glassInfo); |
| | | |
| | | // if(glassInfo.getFlowCardId()=){ |
| | | // |
| | | // } |
| | | if (glassInfo.getGlassId().equals(downStorageCageDetailsService.DirectConnection()) ) { |
| | | //直通 |
| | | log.info("3、如果当前玻璃属于版图id和片序的顺序则直通,执行下片任务"); |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); |
| | | int WorkstationId=downWorkstation.getWorkstationId(); |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", String.valueOf(WorkstationId), "3"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | }else{ |
| | | |
| | | log.info("4、如果不属于版图id和片序的顺序执行进片任务"); |
| | | |
| | | |
| | | //添加进片任务 查找空格 |
| | | List<DownStorageCageDetails> list = downStorageCageService.selectCacheEmpty(); |
| | | if(list.size()>0){ |
| | |
| | | |
| | | |
| | | |
| | | log.info("3、查询卧式理片笼里面的空格:{}", list); |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | log.info("5、查询卧式理片笼里面的空格:{}", list); |
| | | log.info("6、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | DownStorageCageDetails details = new DownStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(1); |
| | |
| | | details.setSlot(item.getSlot()); |
| | | details.setDeviceId(item.getDeviceId()); |
| | | downStorageCageDetailsService.save(details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | log.info("7、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", item.getSlot() + "", "1"); |
| | | //添加进片任务 |
| | | log.info("6、生成进片任务信息存入任务表{}", downGlassTask); |
| | | log.info("8、生成进片任务信息存入任务表{}", downGlassTask); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | log.info("9、发送确认字完成"); |
| | | //S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | log.info("7、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |